diff --git a/distribution/changelog.txt b/distribution/changelog.txt index cacfd22d4d..0b3dc7332f 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -22,6 +22,7 @@ - Change: [#21214] Wacky Worlds and Time Twister’s scenario names now match their park names. - Change: [#21991] UI themes JSON now use colour names and a translucency bool, instead of a number (old themes still work). - Change: [#22057] Reorder Time Twister’s scenarios and adjust their difficulty classification. +- Fix: [#13234] Vehicle weight sometimes wrong after using Remove All Guests cheat. - Fix: [#13294] Map corners are cut off in some directions (original bug). - Fix: [#14630] Non-ASCII thousands and decimal separators not processed correctly. - Fix: [#21974] No reason specified when attempting to place benches, lamps, or bins on path with no unconnected edges (original bug). diff --git a/src/openrct2/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp index ed6875343e..fbfcde548d 100644 --- a/src/openrct2/actions/CheatSetAction.cpp +++ b/src/openrct2/actions/CheatSetAction.cpp @@ -711,10 +711,14 @@ void CheatSetAction::RemoveAllGuests() const for (Vehicle* vehicle = TryGetEntity(trainIndex); vehicle != nullptr; vehicle = TryGetEntity(vehicle->next_vehicle_on_train)) { + auto i = 0; for (auto& peepInTrainIndex : vehicle->peep) { + if (i >= vehicle->num_peeps) + break; + auto peep = TryGetEntity(peepInTrainIndex); - if (peep != nullptr) + if (peep != nullptr && peep->CurrentRide == ride.id) { if ((peep->State == PeepState::OnRide && peep->RideSubState == PeepRideSubState::OnRide) || (peep->State == PeepState::LeavingRide && peep->RideSubState == PeepRideSubState::LeaveVehicle)) @@ -723,6 +727,7 @@ void CheatSetAction::RemoveAllGuests() const } } peepInTrainIndex = EntityId::GetNull(); + i++; } vehicle->num_peeps = 0;