mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-19 13:03:11 +01:00
Part of #13874: TrackElementDescriptor loader
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
#include "platform/Crash.h"
|
||||
#include "platform/Platform2.h"
|
||||
#include "platform/platform.h"
|
||||
#include "ride/TrackData.h"
|
||||
#include "ride/TrackDesignRepository.h"
|
||||
#include "scenario/Scenario.h"
|
||||
#include "scenario/ScenarioRepository.h"
|
||||
@@ -395,6 +396,7 @@ namespace OpenRCT2
|
||||
}
|
||||
_env->SetBasePath(DIRBASE::RCT2, rct2InstallPath);
|
||||
}
|
||||
TrackMetaData::Init();
|
||||
|
||||
_objectRepository = CreateObjectRepository(_env);
|
||||
_objectManager = CreateObjectManager(*_objectRepository);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Track.h"
|
||||
#include "TrackPaint.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
|
||||
// clang-format off
|
||||
@@ -5127,3 +5128,41 @@ const uint16_t TrackFlags[TrackElemType::Count] = {
|
||||
/* TrackElemType::FlatTrack3x3 */ 0,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
namespace TrackMetaData
|
||||
{
|
||||
static std::vector<TrackElementDescriptor> _trackElementDescriptors;
|
||||
void Init()
|
||||
{
|
||||
_trackElementDescriptors.clear();
|
||||
_trackElementDescriptors.reserve(TrackElemType::Count);
|
||||
|
||||
TrackElementDescriptor desc;
|
||||
for (int i = 0; i < TrackElemType::Count; i++)
|
||||
{
|
||||
desc.AlternativeType = AlternativeTrackTypes[i];
|
||||
desc.Block = const_cast<rct_preview_track*>(TrackBlocks[i]);
|
||||
desc.Coordinates = TrackCoordinates[i];
|
||||
desc.CurveChain = gTrackCurveChain[i];
|
||||
desc.Flags = TrackFlags[i];
|
||||
desc.HeightMarkerPositions = TrackHeightMarkerPositions[i];
|
||||
desc.MirrorMap = TrackElementMirrorMap[i];
|
||||
desc.PieceLength = TrackPieceLengths[i];
|
||||
desc.Pricing = TrackPricing[i];
|
||||
|
||||
for (uint8_t j = 0; j < MaxSequencesPerPiece; j++)
|
||||
{
|
||||
desc.SequenceElementAllowedWallEdges[j] = TrackSequenceElementAllowedWallEdges[i][j];
|
||||
desc.TrackSequenceProperties[j] = TrackSequenceProperties[i][j];
|
||||
}
|
||||
_trackElementDescriptors.push_back(desc);
|
||||
}
|
||||
}
|
||||
const TrackElementDescriptor& GetTrackElementDescriptor(const uint32_t& type)
|
||||
{
|
||||
return _trackElementDescriptors[type];
|
||||
}
|
||||
} // namespace TrackMetaData
|
||||
} // namespace OpenRCT2
|
||||
|
||||
@@ -74,3 +74,29 @@ extern const uint32_t TrackHeightMarkerPositions[TrackElemType::Count];
|
||||
extern const uint8_t TrackSequenceElementAllowedWallEdges[TrackElemType::Count][16];
|
||||
|
||||
extern const uint16_t TrackFlags[TrackElemType::Count];
|
||||
|
||||
struct TrackElementDescriptor
|
||||
{
|
||||
rct_track_coordinates Coordinates;
|
||||
|
||||
rct_preview_track* Block;
|
||||
uint8_t PieceLength;
|
||||
track_curve_chain CurveChain;
|
||||
track_type_t AlternativeType;
|
||||
money32 Pricing;
|
||||
track_type_t MirrorMap;
|
||||
uint32_t HeightMarkerPositions;
|
||||
uint16_t Flags;
|
||||
|
||||
std::array<uint8_t, MaxSequencesPerPiece> SequenceElementAllowedWallEdges;
|
||||
std::array<uint8_t, MaxSequencesPerPiece> TrackSequenceProperties;
|
||||
};
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
namespace TrackMetaData
|
||||
{
|
||||
void Init();
|
||||
const TrackElementDescriptor& GetTrackElementDescriptor(const uint32_t& type);
|
||||
} // namespace TrackMetaData
|
||||
} // namespace OpenRCT2
|
||||
|
||||
Reference in New Issue
Block a user