diff --git a/distribution/changelog.txt b/distribution/changelog.txt index ad73c74f33..9138486a7d 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -30,6 +30,7 @@ - Fix: [#15476] Crash when placing/clearing small scenery. - Fix: [#15487] Map animations do not work correctly when loading an exported SV6 file in vanilla RCT2. - Fix: [#15496] Crash in paint_swinging_inverter_ship_structure(). +- Fix: [#15503] Freeze when doing specific coaster merges with block brakes. - Fix: [#15514] Two different “quit to menu” menu items are available in track designer and track design manager. - Improved: [#3417] Crash dumps are now placed in their own folder. - Change: [#8601] Revert ToonTower base block fix to re-enable support blocking. diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index d90387ee35..1eabd0f6cf 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -3492,8 +3492,16 @@ void Ride::MoveTrainsToBlockBrakes(TrackElement* firstBlock) continue; } + size_t numIterations = 0; do { + // Fixes both freezing issues in #15503. + // TODO: refactor the code so a tortoise-and-hare algorithm can be used. + if (numIterations++ > 1000000) + { + break; + } + firstBlock->SetBlockBrakeClosed(true); for (Vehicle* car = train; car != nullptr; car = GetEntity(car->next_vehicle_on_train)) {