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
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 17 additions and 0 deletions

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();