1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

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
This commit is contained in:
Jater Xu
2025-09-02 10:33:18 -07:00
parent 6fb00193ac
commit d90329731d
3 changed files with 11 additions and 11 deletions

View File

@@ -327,7 +327,7 @@ namespace OpenRCT2::Title
auto& gameState = getGameState(); auto& gameState = getGameState();
parkImporter->Import(gameState); parkImporter->Import(gameState);
GameFixSaveVars(true); GameFixSaveVars();
ReportProgress(100); ReportProgress(100);

View File

@@ -182,7 +182,7 @@ void RCT2StringToUTF8Self(char* buffer, size_t length)
} }
} }
static void FixGuestsHeadingToParkCount(const bool bIgnoreWarning) static void FixGuestsHeadingToParkCount()
{ {
uint32_t guestsHeadingToPark = 0; uint32_t guestsHeadingToPark = 0;
@@ -195,16 +195,16 @@ static void FixGuestsHeadingToParkCount(const bool bIgnoreWarning)
} }
auto& park = getGameState().park; 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); "Corrected bad amount of guests heading to park: %u -> %u", park.numGuestsHeadingForPark, guestsHeadingToPark);
} }
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 // Recalculates peep count after loading a save to fix corrupted files
uint32_t guestCount = 0; uint32_t guestCount = 0;
@@ -218,9 +218,9 @@ static void FixGuestCount(const bool bIgnoreWarning)
} }
auto& park = getGameState().park; 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; 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. // 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. // 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(); FixPeepsWithInvalidRideReference();

View File

@@ -174,7 +174,7 @@ void SaveGameCmd(u8string_view name = {});
void SaveGameWithName(u8string_view name); void SaveGameWithName(u8string_view name);
void GameAutosave(); void GameAutosave();
void RCT2StringToUTF8Self(char* buffer, size_t length); void RCT2StringToUTF8Self(char* buffer, size_t length);
void GameFixSaveVars(const bool bShouldIgnoreWarning = false); void GameFixSaveVars();
void StartSilentRecord(); void StartSilentRecord();
bool StopSilentRecord(); bool StopSilentRecord();
void PrepareMapForSave(); void PrepareMapForSave();