From 5ce61bfb95a64abe70a02f031596c86060e1f1cd Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 20 Jan 2024 18:45:10 -0300 Subject: [PATCH] Move merry-go-round fix to patch --- data/scenario_patches/Urban Park.json | 8 ++++- src/openrct2/rct1/S4Importer.cpp | 48 --------------------------- 2 files changed, 7 insertions(+), 49 deletions(-) diff --git a/data/scenario_patches/Urban Park.json b/data/scenario_patches/Urban Park.json index a12f66bc04..5afb2eaf4c 100644 --- a/data/scenario_patches/Urban Park.json +++ b/data/scenario_patches/Urban Park.json @@ -10,5 +10,11 @@ [ 46, 47 ] ] } - } + }, + "rides": [ + { + "id": 0, + "operation": "swap_entrance_exit" + } + ] } diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 7db116e4d8..b4906d7422 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -196,7 +196,6 @@ namespace OpenRCT2::RCT1 // TODO: investigate why Katie's Dreamland.s4 and .sea have different patches // TODO: s4 patch system is broken since .s4 files do not use scenario name, but rather slot RCT12::FetchAndApplyScenarioPatch(_s4.ScenarioName, _isScenario); - FixUrbanPark(); FixNextGuestNumber(gameState); CountBlockSections(); SetDefaultNames(); @@ -2517,53 +2516,6 @@ namespace OpenRCT2::RCT1 return justText.data(); } - /** - * In Urban Park, the entrance and exit of the merry-go-round are the wrong way round. This code fixes that. - * To avoid messing up saves (in which this problem is most likely solved by the user), only carry out this - * fix when loading from a scenario. - */ - void FixUrbanPark() - { - if (_s4.ScenarioSlotIndex == SC_URBAN_PARK && _isScenario) - { - const auto merryGoRoundId = RideId::FromUnderlying(0); - - // First, make the queuing peep exit - for (auto peep : EntityList()) - { - if (peep->State == PeepState::QueuingFront && peep->CurrentRide == merryGoRoundId) - { - peep->RemoveFromQueue(); - peep->SetState(PeepState::Falling); - break; - } - } - - // Now, swap the entrance and exit. - auto ride = GetRide(merryGoRoundId); - if (ride != nullptr) - { - auto& station = ride->GetStation(); - auto entranceCoords = station.Exit; - auto exitCoords = station.Entrance; - station.Entrance = entranceCoords; - station.Exit = exitCoords; - - auto entranceElement = MapGetRideExitElementAt(entranceCoords.ToCoordsXYZD(), false); - entranceElement->SetEntranceType(ENTRANCE_TYPE_RIDE_ENTRANCE); - auto exitElement = MapGetRideEntranceElementAt(exitCoords.ToCoordsXYZD(), false); - exitElement->SetEntranceType(ENTRANCE_TYPE_RIDE_EXIT); - - // Trigger footpath update - FootpathQueueChainReset(); - FootpathConnectEdges( - entranceCoords.ToCoordsXY(), reinterpret_cast(entranceElement), - GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); - FootpathUpdateQueueChains(); - } - } - } - void FixNextGuestNumber(GameState_t& gameState) { // In RCT1, the next guest number is not saved, so we have to calculate it.