Skip to content

Commit

Permalink
Move gPeepWarningThrottle to GameState_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-Hopkinson committed Mar 14, 2024
1 parent 15650ad commit b69db13
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/openrct2/GameState.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ namespace OpenRCT2
std::vector<ScenerySelection> RestrictedScenery;

std::vector<PeepSpawn> PeepSpawns;
uint8_t PeepWarningThrottle[16];

News::ItemQueues NewsItems;

Expand Down
7 changes: 3 additions & 4 deletions src/openrct2/entity/Peep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@
using namespace OpenRCT2;
using namespace OpenRCT2::Audio;

uint8_t gPeepWarningThrottle[16];

static uint8_t _unk_F1AEF0;
static TileElement* _peepRideEntranceExitElement;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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])
Expand Down
2 changes: 0 additions & 2 deletions src/openrct2/entity/Peep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/management/NewsItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/park/ParkFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/rct2/S6Importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b69db13

Please sign in to comment.