diff --git a/src/openrct2/GameState.h b/src/openrct2/GameState.h index 784f94eb56..961ceaec78 100644 --- a/src/openrct2/GameState.h +++ b/src/openrct2/GameState.h @@ -94,6 +94,10 @@ namespace OpenRCT2 * awards, approximately 1 guest per second can be generated (+60 guests in one minute). */ int32_t GuestGenerationProbability; + /** + * In a difficult guest generation scenario, no guests will be generated if over this value. + */ + uint32_t SuggestedGuestMaximum; }; GameState_t& GetGameState(); diff --git a/src/openrct2/ReplayManager.cpp b/src/openrct2/ReplayManager.cpp index b787552d64..ccf52be267 100644 --- a/src/openrct2/ReplayManager.cpp +++ b/src/openrct2/ReplayManager.cpp @@ -668,7 +668,7 @@ namespace OpenRCT2 auto& gameState = GetGameState(); serialiser << gameState.GuestGenerationProbability; - serialiser << _suggestedGuestMaximum; + serialiser << gameState.SuggestedGuestMaximum; serialiser << gConfigGeneral.ShowRealNamesOfGuests; // To make this a little bit less volatile against updates diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 1e572adf86..c964bb6cfe 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -910,7 +910,7 @@ namespace OpenRCT2 cs.ReadWrite(gameState.NumGuestsInParkLastWeek); cs.ReadWrite(gGuestChangeModifier); cs.ReadWrite(gameState.GuestGenerationProbability); - cs.ReadWrite(_suggestedGuestMaximum); + cs.ReadWrite(gameState.SuggestedGuestMaximum); cs.ReadWriteArray(gPeepWarningThrottle, [&cs](uint8_t& value) { cs.ReadWrite(value); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 978f63ecd9..9f9cdbb11b 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -404,7 +404,7 @@ namespace RCT2 gParkRatingCasualtyPenalty = _s6.ParkRatingCasualtyPenalty; gMapSize = { _s6.MapSize, _s6.MapSize }; gSamePriceThroughoutPark = _s6.SamePriceThroughout | (static_cast(_s6.SamePriceThroughoutExtended) << 32); - _suggestedGuestMaximum = _s6.SuggestedMaxGuests; + gameState.SuggestedGuestMaximum = _s6.SuggestedMaxGuests; gameState.ScenarioParkRatingWarningDays = _s6.ParkRatingWarningDays; gLastEntranceStyle = _s6.LastEntranceStyle; // rct1_water_colour diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index 54ccdc4964..494d96723d 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -139,7 +139,7 @@ namespace OpenRCT2::Scripting uint32_t ScPark::suggestedGuestMaximum_get() const { - return _suggestedGuestMaximum; + return GetGameState().SuggestedGuestMaximum; } int32_t ScPark::guestGenerationProbability_get() const diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 083f0cf434..203817ec23 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -58,11 +58,6 @@ uint32_t gGuestsInParkHistory[32]; // If this value is more than or equal to 0, the park rating is forced to this value. Used for cheat static int32_t _forcedParkRating = -1; -/** - * In a difficult guest generation scenario, no guests will be generated if over this value. - */ -uint32_t _suggestedGuestMaximum; - /** * Choose a random peep spawn and iterates through until defined spawn is found. */ @@ -253,7 +248,7 @@ void Park::Initialise() gameState.ParkRating = 0; gameState.GuestGenerationProbability = 0; gameState.TotalRideValueForMoney = 0; - _suggestedGuestMaximum = 0; + gameState.SuggestedGuestMaximum = 0; gameState.ResearchLastItem = std::nullopt; gMarketingCampaigns.clear(); @@ -312,7 +307,7 @@ void Park::Update(const Date& date) gameState.ParkValue = CalculateParkValue(); gCompanyValue = CalculateCompanyValue(); gameState.TotalRideValueForMoney = CalculateTotalRideValueForMoney(); - _suggestedGuestMaximum = CalculateSuggestedMaxGuests(); + gameState.SuggestedGuestMaximum = CalculateSuggestedMaxGuests(); gameState.GuestGenerationProbability = CalculateGuestGenerationProbability(); WindowInvalidateByClass(WindowClass::Finances); @@ -596,7 +591,7 @@ uint32_t Park::CalculateGuestGenerationProbability() const // The more guests, the lower the chance of a new one uint32_t numGuests = gameState.NumGuestsInPark + gameState.NumGuestsHeadingForPark; - if (numGuests > _suggestedGuestMaximum) + if (numGuests > gameState.SuggestedGuestMaximum) { probability /= 4; // Even lower for difficult guest generation @@ -671,7 +666,7 @@ void Park::GenerateGuests() if (static_cast(ScenarioRand() & 0xFFFF) < gameState.GuestGenerationProbability) { bool difficultGeneration = (gameState.ParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) != 0; - if (!difficultGeneration || _suggestedGuestMaximum + 150 >= gameState.NumGuestsInPark) + if (!difficultGeneration || gameState.SuggestedGuestMaximum + 150 >= gameState.NumGuestsInPark) { GenerateGuest(); } diff --git a/src/openrct2/world/Park.h b/src/openrct2/world/Park.h index b9de76a63e..823a5f6aa6 100644 --- a/src/openrct2/world/Park.h +++ b/src/openrct2/world/Park.h @@ -99,7 +99,6 @@ extern money64 gCompanyValue; extern int16_t gParkRatingCasualtyPenalty; extern uint32_t gGuestsInParkHistory[32]; -extern uint32_t _suggestedGuestMaximum; void ParkSetForcedRating(int32_t rating); int32_t ParkGetForcedRating();