From d90329731d3415fcfaa3db4d8c295b79a7ec56e5 Mon Sep 17 00:00:00 2001 From: Jater Xu Date: Tue, 2 Sep 2025 10:33:18 -0700 Subject: [PATCH] Fix for Attempt to decrement guests in park and guests heading for park below zero. Updated Review: - Removed ignore warning variable - Changed the log level of the related warnings to verbose --- src/openrct2-ui/title/TitleSequencePlayer.cpp | 2 +- src/openrct2/Game.cpp | 18 +++++++++--------- src/openrct2/Game.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp index 9980a1c8ff..0b1958eafa 100644 --- a/src/openrct2-ui/title/TitleSequencePlayer.cpp +++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp @@ -327,7 +327,7 @@ namespace OpenRCT2::Title auto& gameState = getGameState(); parkImporter->Import(gameState); - GameFixSaveVars(true); + GameFixSaveVars(); ReportProgress(100); diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 38bfbd6337..a12b91dd0c 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -182,7 +182,7 @@ void RCT2StringToUTF8Self(char* buffer, size_t length) } } -static void FixGuestsHeadingToParkCount(const bool bIgnoreWarning) +static void FixGuestsHeadingToParkCount() { uint32_t guestsHeadingToPark = 0; @@ -195,16 +195,16 @@ static void FixGuestsHeadingToParkCount(const bool bIgnoreWarning) } auto& park = getGameState().park; - if (!bIgnoreWarning && park.numGuestsHeadingForPark != guestsHeadingToPark) + if (park.numGuestsHeadingForPark != guestsHeadingToPark) { - LOG_WARNING( + LOG_VERBOSE( "Corrected bad amount of guests heading to park: %u -> %u", park.numGuestsHeadingForPark, guestsHeadingToPark); } park.numGuestsHeadingForPark = guestsHeadingToPark; } -static void FixGuestCount(const bool bIgnoreWarning) +static void FixGuestCount() { // Recalculates peep count after loading a save to fix corrupted files uint32_t guestCount = 0; @@ -218,9 +218,9 @@ static void FixGuestCount(const bool bIgnoreWarning) } auto& park = getGameState().park; - if (!bIgnoreWarning && park.numGuestsInPark != guestCount) + if (park.numGuestsInPark != guestCount) { - LOG_WARNING("Corrected bad amount of guests in park: %u -> %u", park.numGuestsInPark, guestCount); + LOG_VERBOSE("Corrected bad amount of guests in park: %u -> %u", park.numGuestsInPark, guestCount); } park.numGuestsInPark = guestCount; @@ -317,11 +317,11 @@ static void FixInvalidSurfaces() // OpenRCT2 workaround to recalculate some values which are saved redundantly in the save to fix corrupted files. // For example recalculate guest count by looking at all the guests instead of trusting the value in the file. -void GameFixSaveVars(const bool bShouldIgnoreWarning) +void GameFixSaveVars() { - FixGuestsHeadingToParkCount(bShouldIgnoreWarning); + FixGuestsHeadingToParkCount(); - FixGuestCount(bShouldIgnoreWarning); + FixGuestCount(); FixPeepsWithInvalidRideReference(); diff --git a/src/openrct2/Game.h b/src/openrct2/Game.h index 0619199a06..68ef7e65df 100644 --- a/src/openrct2/Game.h +++ b/src/openrct2/Game.h @@ -174,7 +174,7 @@ void SaveGameCmd(u8string_view name = {}); void SaveGameWithName(u8string_view name); void GameAutosave(); void RCT2StringToUTF8Self(char* buffer, size_t length); -void GameFixSaveVars(const bool bShouldIgnoreWarning = false); +void GameFixSaveVars(); void StartSilentRecord(); bool StopSilentRecord(); void PrepareMapForSave();