diff --git a/src/openrct2/GameState.h b/src/openrct2/GameState.h index b6b3a70e35..f69913c9a3 100644 --- a/src/openrct2/GameState.h +++ b/src/openrct2/GameState.h @@ -102,6 +102,7 @@ namespace OpenRCT2 std::vector RestrictedScenery; std::vector PeepSpawns; + uint8_t PeepWarningThrottle[16]; News::ItemQueues NewsItems; diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 9584f4f9af..59c4a9bd78 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -66,8 +66,6 @@ using namespace OpenRCT2; using namespace OpenRCT2::Audio; -uint8_t gPeepWarningThrottle[16]; - static uint8_t _unk_F1AEF0; static TileElement* _peepRideEntranceExitElement; @@ -1037,10 +1035,12 @@ void Peep::Update() */ void PeepProblemWarningsUpdate() { + auto& gameState = GetGameState(); + Ride* ride; uint32_t hungerCounter = 0, lostCounter = 0, noexitCounter = 0, thirstCounter = 0, litterCounter = 0, disgustCounter = 0, toiletCounter = 0, vandalismCounter = 0; - uint8_t* warningThrottle = gPeepWarningThrottle; + uint8_t* warningThrottle = gameState.PeepWarningThrottle; int32_t inQueueCounter = 0; int32_t tooLongQueueCounter = 0; @@ -1116,7 +1116,6 @@ void PeepProblemWarningsUpdate() break; } } - auto& gameState = GetGameState(); // could maybe be packed into a loop, would lose a lot of clarity though if (warningThrottle[0]) diff --git a/src/openrct2/entity/Peep.h b/src/openrct2/entity/Peep.h index 0586d41408..794103dac7 100644 --- a/src/openrct2/entity/Peep.h +++ b/src/openrct2/entity/Peep.h @@ -459,8 +459,6 @@ enum extern const PeepAnimationEntry g_peep_animation_entries[EnumValue(PeepSpriteType::Count)]; extern const bool gSpriteTypeToSlowWalkMap[48]; -extern uint8_t gPeepWarningThrottle[16]; - int32_t PeepGetStaffCount(); void PeepUpdateAll(); void PeepProblemWarningsUpdate(); diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index e3ee26bc9f..62c0d281bc 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -112,7 +112,7 @@ void News::InitQueue() assert(gameState.NewsItems.IsEmpty()); // Throttles for warning types (PEEP_*_WARNING) - for (auto& warningThrottle : gPeepWarningThrottle) + for (auto& warningThrottle : gameState.PeepWarningThrottle) { warningThrottle = 0; } diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 2ca2cb402e..27e09b9a13 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -912,7 +912,7 @@ namespace OpenRCT2 cs.ReadWrite(gameState.GuestGenerationProbability); cs.ReadWrite(gameState.SuggestedGuestMaximum); - cs.ReadWriteArray(gPeepWarningThrottle, [&cs](uint8_t& value) { + cs.ReadWriteArray(gameState.PeepWarningThrottle, [&cs](uint8_t& value) { cs.ReadWrite(value); return true; }); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 802308716f..10631bb15a 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -375,7 +375,7 @@ namespace RCT2 gameState.TotalAdmissions = _s6.TotalAdmissions; gameState.TotalIncomeFromAdmissions = ToMoney64(_s6.IncomeFromAdmissions); gameState.CompanyValue = ToMoney64(_s6.CompanyValue); - std::memcpy(gPeepWarningThrottle, _s6.PeepWarningThrottle, sizeof(_s6.PeepWarningThrottle)); + std::memcpy(gameState.PeepWarningThrottle, _s6.PeepWarningThrottle, sizeof(_s6.PeepWarningThrottle)); // Awards auto& awards = GetAwards();