From 4e7587db13fa24fe975bc93d8f900a027b372d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:26:30 +0300 Subject: [PATCH] Re-calculate the amount of guests heading to the park on import --- src/openrct2/Game.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 0e3ddf1de1..cb064d33f7 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -345,6 +345,21 @@ void RCT2StringToUTF8Self(char* buffer, size_t length) } } +static void FixGuestsHeadingToParkCount() +{ + uint32_t guestsHeadingToPark = 0; + + for (auto* peep : EntityList()) + { + 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();