mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-26 16:24:35 +01:00
Limit track design object lookup to ride types where it's needed
This commit is contained in:
@@ -48,6 +48,22 @@ ObjectEntryIndex RCT2RideTypeToOpenRCT2RideType(uint8_t rct2RideType, const rct_
|
||||
}
|
||||
}
|
||||
|
||||
bool RCT2RideTypeNeedsConversion(uint8_t rct2RideType)
|
||||
{
|
||||
switch (rct2RideType)
|
||||
{
|
||||
case RIDE_TYPE_CORKSCREW_ROLLER_COASTER:
|
||||
case RIDE_TYPE_JUNIOR_ROLLER_COASTER:
|
||||
case RIDE_TYPE_CAR_RIDE:
|
||||
case RIDE_TYPE_TWISTER_ROLLER_COASTER:
|
||||
case RIDE_TYPE_STEEL_WILD_MOUSE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t OpenRCT2RideTypeToRCT2RideType(ObjectEntryIndex openrct2Type)
|
||||
{
|
||||
switch (openrct2Type)
|
||||
|
||||
@@ -766,4 +766,5 @@ assert_struct_size(RCT2RideRatingCalculationData, 76);
|
||||
|
||||
std::vector<uint8_t> DecryptSea(const fs::path& path);
|
||||
ObjectEntryIndex RCT2RideTypeToOpenRCT2RideType(uint8_t rct2RideType, const rct_ride_entry* rideEntry);
|
||||
bool RCT2RideTypeNeedsConversion(uint8_t rct2RideType);
|
||||
uint8_t OpenRCT2RideTypeToRCT2RideType(ObjectEntryIndex openrct2Type);
|
||||
|
||||
@@ -81,7 +81,8 @@ public:
|
||||
auto td6 = track_design_open(path.c_str());
|
||||
if (td6 != nullptr)
|
||||
{
|
||||
ObjectEntryIndex rideType = RIDE_TYPE_NULL;
|
||||
ObjectEntryIndex rideType = td6->type;
|
||||
if (RCT2RideTypeNeedsConversion(td6->type))
|
||||
{
|
||||
std::scoped_lock<std::mutex> lock(_objectLookupMutex);
|
||||
auto* rawObject = object_repository_load_object(&td6->vehicle_object);
|
||||
|
||||
Reference in New Issue
Block a user