1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-29 09:44:52 +01:00

Fix #15503: Freeze when doing specific merges

This commit is contained in:
Michael Steenbeek
2021-10-06 23:00:06 +02:00
committed by GitHub
parent c054967230
commit 5563139ed1
2 changed files with 9 additions and 0 deletions

View File

@@ -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.

View File

@@ -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<Vehicle>(car->next_vehicle_on_train))
{