1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 15:24:30 +01:00

Fix #6833: shops and maze in corrupted file not imported correctly

This commit is contained in:
Gymnasiast
2017-12-31 18:55:52 +01:00
parent db7efda880
commit a435fd7434

View File

@@ -511,9 +511,12 @@ private:
for (size_t i = 0; i < Util::CountOf(_s4.rides); i++)
{
rct1_ride * ride = &_s4.rides[i];
if (ride->type != RCT1_RIDE_TYPE_NULL && RCT1::RideTypeUsesVehicles(ride->type))
if (ride->type != RCT1_RIDE_TYPE_NULL)
{
AddEntryForVehicleType(ride->type, ride->vehicle_type);
if (RCT1::RideTypeUsesVehicles(ride->type))
AddEntryForVehicleType(ride->type, ride->vehicle_type);
else
AddEntryForRideType(ride->type);
}
}
}
@@ -724,7 +727,8 @@ private:
// This can happen with hacked parks
if (rideEntry == nullptr)
{
dst = nullptr;
log_warning("Discarding ride with invalid ride entry");
dst->type = RIDE_TYPE_NULL;
return;
}
@@ -935,6 +939,16 @@ private:
void SetRideColourScheme(Ride * dst, rct1_ride * src)
{
// In RCT1 and AA, the maze was always hedges.
// LL has 4 types, like RCT2. For LL, only guard against invalid values.
if (dst->type == RIDE_TYPE_MAZE)
{
if (_gameVersion < FILE_VERSION_RCT1_LL || src->track_colour_supports[0] > 3)
dst->track_colour_supports[0] = MAZE_WALL_TYPE_HEDGE;
return;
}
// Colours
dst->colour_scheme_type = src->colour_scheme;
if (_gameVersion == FILE_VERSION_RCT1)