diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index d964800b4c..5be5e18ff8 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -982,7 +982,7 @@ namespace OpenRCT2 auto found = os.ReadWriteChunk( ParkFileChunkType::TILES, - [pathToSurfaceMap, pathToQueueSurfaceMap, pathToRailingsMap](OrcaStream::ChunkStream& cs) { + [pathToSurfaceMap, pathToQueueSurfaceMap, pathToRailingsMap, &os](OrcaStream::ChunkStream& cs) { cs.ReadWrite(gMapSize.x); cs.ReadWrite(gMapSize.y); @@ -1018,6 +1018,16 @@ namespace OpenRCT2 } } } + else if (it.element->GetType() == TileElementType::Track) + { + auto* trackElement = it.element->AsTrack(); + if (TrackTypeMustBeMadeInvisible( + trackElement->GetRideType(), trackElement->GetTrackType(), + os.GetHeader().TargetVersion)) + { + it.element->SetInvisible(true); + } + } } } ParkEntranceUpdateLocations(); diff --git a/src/openrct2/park/ParkFile.h b/src/openrct2/park/ParkFile.h index 5594368119..7df5ab0959 100644 --- a/src/openrct2/park/ParkFile.h +++ b/src/openrct2/park/ParkFile.h @@ -8,7 +8,7 @@ struct ObjectRepositoryItem; namespace OpenRCT2 { // Current version that is saved. - constexpr uint32_t PARK_FILE_CURRENT_VERSION = 15; + constexpr uint32_t PARK_FILE_CURRENT_VERSION = 16; // The minimum version that is forwards compatible with the current version. constexpr uint32_t PARK_FILE_MIN_VERSION = 14; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 7496e1228f..2e608ada20 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1692,6 +1692,11 @@ namespace RCT1 dst2->SetMazeEntry(src2->GetMazeEntry()); } + if (TrackTypeMustBeMadeInvisible(rideType, trackType)) + { + dst->SetInvisible(true); + } + return 1; } case TileElementType::SmallScenery: diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 3d0a27d4ba..1ab1bf8d4b 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1442,6 +1442,11 @@ namespace RCT2 dst2->SetSeatRotation(src2->GetSeatRotation()); } + if (TrackTypeMustBeMadeInvisible(rideType, dst2->GetTrackType())) + { + dst->SetInvisible(true); + } + break; } case RCT12TileElementType::SmallScenery: diff --git a/src/openrct2/ride/Track.cpp b/src/openrct2/ride/Track.cpp index ffa318575f..6652a7c073 100644 --- a/src/openrct2/ride/Track.cpp +++ b/src/openrct2/ride/Track.cpp @@ -918,3 +918,20 @@ void TrackElement::SetHighlight(bool on) if (on) Flags2 |= TRACK_ELEMENT_FLAGS2_HIGHLIGHT; } + +bool TrackTypeMustBeMadeInvisible(ride_type_t rideType, track_type_t trackType, int32_t parkFileVersion) +{ + // Lots of Log Flumes exist where the downward slopes are simulated by using other track + // types like the Splash Boats, but not actually made invisible, because they never needed + // to be. + if (rideType == RIDE_TYPE_LOG_FLUME && parkFileVersion <= 15) + { + if (trackType == TrackElemType::Down25ToDown60 || trackType == TrackElemType::Down60 + || trackType == TrackElemType::Down60ToDown25) + { + return true; + } + } + + return false; +} diff --git a/src/openrct2/ride/Track.h b/src/openrct2/ride/Track.h index bfaa6f8f17..c8fd0f4e6b 100644 --- a/src/openrct2/ride/Track.h +++ b/src/openrct2/ride/Track.h @@ -634,3 +634,16 @@ ResultWithMessage track_remove_station_element(const CoordsXYZD& loc, RideId rid bool TrackTypeHasSpeedSetting(track_type_t trackType); std::optional GetTrackSegmentOrigin(const CoordsXYE& posEl); + +/** + * If new pieces get added to existing ride types, this could cause existing parks to change appearance, + * since the formerly unrendered pieces were not explicitly set invisible. + * To avoid this, this function will return true if the piece is question was added after the park was created, + * so that import code can properly set the visibility. + * + * @param rideType The OpenRCT2 ride type + * @param trackType The OpenRCT2 track type + * @param parkFileVersion The current park file version. Pass -1 when converting S4 or S6. + * @return + */ +bool TrackTypeMustBeMadeInvisible(ride_type_t rideType, track_type_t trackType, int32_t parkFileVersion = -1);