1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Re-calculate the amount of guests heading to the park on import

This commit is contained in:
ζeh Matt
2023-10-20 14:26:30 +03:00
parent a45d72f562
commit 4e7587db13

View File

@@ -345,6 +345,21 @@ void RCT2StringToUTF8Self(char* buffer, size_t length)
}
}
static void FixGuestsHeadingToParkCount()
{
uint32_t guestsHeadingToPark = 0;
for (auto* peep : EntityList<Guest>())
{
if (peep->OutsideOfPark && peep->State != PeepState::LeavingPark)
{
guestsHeadingToPark++;
}
}
gNumGuestsHeadingForPark = guestsHeadingToPark;
}
static void FixGuestCount()
{
// Recalculates peep count after loading a save to fix corrupted files
@@ -454,6 +469,8 @@ static void FixInvalidSurfaces()
// For example recalculate guest count by looking at all the guests instead of trusting the value in the file.
void GameFixSaveVars()
{
FixGuestsHeadingToParkCount();
FixGuestCount();
FixPeepsWithInvalidRideReference();