Fix #25190: Inserting block brake while a coaster is simulating will cause strange simulation behaviour

This commit is contained in:
Michael Steenbeek authored and GitHub committed 2025-10-16 17:48:05 +02:00
commit f3f97018cb
6 files changed
+26 -19

No files matched your search

+1
View File
@@ -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).
+3 -2
View File
@@ -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<uint8_t>(newMode));
ExecuteNested(&rideSetSetting, gameState);
+12 -4
View File
@@ -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<uint8_t>(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<uint8_t>(newMode));
ExecuteNested(&rideSetSetting, gameState);
}
}
}
break;
+1 -1
View File
@@ -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);
+3 -12
View File
@@ -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());
}
}
+6
View File
@@ -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)