diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 05a13a5bd3..dbcea55308 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -2,6 +2,7 @@ ------------------------------------------------------------------------ - Change: [#25089] Peep actions and animations that cause them to stop moving no longer trigger when they are on a level crossing. - Fix: [#22779, #25330] Incorrect queue paths in Nevermore Park and Six Flags Holland scenarios (bug in the original scenarios). +- Fix: [#25190] Inserting a block brake while a coaster is simulating will cause the simulation to behave strangely. - Fix: [#25272] Text colour dropdown in the Banner window is too narrow, resulting in truncated labels. - Fix: [#25299] The Mine Train Coaster left large helix draws incorrect sprites at certain angles (original bug). - Fix: [#25328] Spiral Slide in Blackpool Pleasure Beach has its entrance and exit the wrong way round (bug in the original scenario). diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index 28581c1af3..fb7af29227 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -667,21 +667,21 @@ namespace OpenRCT2::GameActions // Update ride stats and block brake count if the piece was successfully built if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - InvalidateTestResults(*ride); switch (_trackType) { case TrackElemType::OnRidePhoto: ride->lifecycleFlags |= RIDE_LIFECYCLE_ON_RIDE_PHOTO; + InvalidateTestResults(*ride); break; case TrackElemType::CableLiftHill: ride->lifecycleFlags |= RIDE_LIFECYCLE_CABLE_LIFT_HILL_COMPONENT_USED; ride->cableLiftLoc = originLocation; + InvalidateTestResults(*ride); break; case TrackElemType::DiagBlockBrakes: case TrackElemType::BlockBrakes: { ride->numBlockBrakes++; - ride->windowInvalidateFlags |= RIDE_INVALIDATE_RIDE_OPERATING; auto newMode = RideModeGetBlockSectionedCounterpart(ride->mode); if (ride->mode != newMode) @@ -689,6 +689,7 @@ namespace OpenRCT2::GameActions bool canSwitch = rtd.SupportsRideMode(newMode) || getGameState().cheats.showAllOperatingModes; if (canSwitch) { + ride->windowInvalidateFlags |= RIDE_INVALIDATE_RIDE_OPERATING; auto rideSetSetting = GameActions::RideSetSettingAction( ride->id, GameActions::RideSetSetting::Mode, static_cast(newMode)); ExecuteNested(&rideSetSetting, gameState); diff --git a/src/openrct2/actions/TrackRemoveAction.cpp b/src/openrct2/actions/TrackRemoveAction.cpp index ab0178ab3c..19bd8ed2c4 100644 --- a/src/openrct2/actions/TrackRemoveAction.cpp +++ b/src/openrct2/actions/TrackRemoveAction.cpp @@ -452,7 +452,6 @@ namespace OpenRCT2::GameActions ride->numBlockBrakes--; if (ride->numBlockBrakes == 0 && ride->isBlockSectioned()) { - ride->windowInvalidateFlags |= RIDE_INVALIDATE_RIDE_OPERATING; RideMode newMode = RideMode::continuousCircuit; if (ride->mode == RideMode::poweredLaunchBlockSectioned) { @@ -460,9 +459,18 @@ namespace OpenRCT2::GameActions newMode = ride->getRideTypeDescriptor().DefaultMode; } - auto rideSetSetting = GameActions::RideSetSettingAction( - ride->id, GameActions::RideSetSetting::Mode, static_cast(newMode)); - ExecuteNested(&rideSetSetting, gameState); + if (ride->mode != newMode) + { + bool canSwitch = ride->getRideTypeDescriptor().SupportsRideMode(newMode) + || getGameState().cheats.showAllOperatingModes; + if (canSwitch) + { + ride->windowInvalidateFlags |= RIDE_INVALIDATE_RIDE_OPERATING; + auto rideSetSetting = GameActions::RideSetSettingAction( + ride->id, GameActions::RideSetSetting::Mode, static_cast(newMode)); + ExecuteNested(&rideSetSetting, gameState); + } + } } break; diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 4b4b963c2d..cad46ba29e 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -47,7 +47,7 @@ // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -constexpr uint8_t kStreamVersion = 1; +constexpr uint8_t kStreamVersion = 2; const std::string kStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kStreamVersion); diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 2b5d60bd79..5a1fb4ecf7 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -1175,18 +1175,9 @@ void Ride::update() // If ride is simulating but crashed, reset the vehicles if (status == RideStatus::simulating && (lifecycleFlags & RIDE_LIFECYCLE_CRASHED)) { - if (mode == RideMode::continuousCircuitBlockSectioned || mode == RideMode::poweredLaunchBlockSectioned) - { - // We require this to execute right away during the simulation, always ignore network and queue. - auto gameAction = GameActions::RideSetStatusAction(id, RideStatus::closed); - GameActions::ExecuteNested(&gameAction, getGameState()); - } - else - { - // We require this to execute right away during the simulation, always ignore network and queue. - auto gameAction = GameActions::RideSetStatusAction(id, RideStatus::simulating); - GameActions::ExecuteNested(&gameAction, getGameState()); - } + // We require this to execute right away during the simulation, always ignore network and queue. + auto gameAction = GameActions::RideSetStatusAction(id, RideStatus::simulating); + GameActions::ExecuteNested(&gameAction, getGameState()); } } diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 95286fe0a7..589a0899d3 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -236,6 +236,12 @@ void RideClearForConstruction(Ride& ride) ride.removeVehicles(); RideClearBlockedTiles(ride); + // Force close simulating rides, to reset flag widget in Construction UI + if (ride.status == RideStatus::simulating) + { + ride.status = RideStatus::closed; + } + auto* windowMgr = Ui::GetWindowManager(); auto w = windowMgr->FindByNumber(WindowClass::ride, ride.id.ToUnderlying()); if (w != nullptr)