1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 05:53:02 +01:00

Fix #13234: Wrong vehicle weight after using Remove All Guests cheat

This commit is contained in:
Michael Steenbeek
2024-05-29 01:29:43 +02:00
committed by GitHub
parent 6ac6db489c
commit fc0b5fde27
2 changed files with 7 additions and 1 deletions

View File

@@ -711,10 +711,14 @@ void CheatSetAction::RemoveAllGuests() const
for (Vehicle* vehicle = TryGetEntity<Vehicle>(trainIndex); vehicle != nullptr;
vehicle = TryGetEntity<Vehicle>(vehicle->next_vehicle_on_train))
{
auto i = 0;
for (auto& peepInTrainIndex : vehicle->peep)
{
if (i >= vehicle->num_peeps)
break;
auto peep = TryGetEntity<Guest>(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;