mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use real values for gGuestsInParkHistory
This commit is contained in:
parent
6db0c01fdc
commit
f0ee6de5fc
|
@ -1062,7 +1062,20 @@ static void window_park_guests_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
// Graph
|
||||
screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 47, widget->top + 26 };
|
||||
|
||||
Graph::Draw(dpi, gGuestsInParkHistory, 32, screenPos);
|
||||
uint8_t cappedHistory[32];
|
||||
for (size_t i = 0; i < std::size(cappedHistory); i++)
|
||||
{
|
||||
auto value = gGuestsInParkHistory[i];
|
||||
if (value != std::numeric_limits<uint32_t>::max())
|
||||
{
|
||||
cappedHistory[i] = static_cast<uint8_t>(std::min<uint32_t>(value, 5000) / 20);
|
||||
}
|
||||
else
|
||||
{
|
||||
cappedHistory[i] = std::numeric_limits<uint8_t>::max();
|
||||
}
|
||||
}
|
||||
Graph::Draw(dpi, cappedHistory, static_cast<int32_t>(std::size(cappedHistory)), screenPos);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
|
|
@ -647,7 +647,7 @@ namespace OpenRCT2
|
|||
return true;
|
||||
});
|
||||
|
||||
cs.ReadWriteArray(gGuestsInParkHistory, [&cs](uint8_t& value) {
|
||||
cs.ReadWriteArray(gGuestsInParkHistory, [&cs](uint32_t& value) {
|
||||
cs.ReadWrite(value);
|
||||
return true;
|
||||
});
|
||||
|
|
|
@ -2076,9 +2076,13 @@ private:
|
|||
}
|
||||
|
||||
// Number of guests history
|
||||
for (size_t i = 0; i < 32; i++)
|
||||
std::fill(std::begin(gGuestsInParkHistory), std::end(gGuestsInParkHistory), std::numeric_limits<uint32_t>::max());
|
||||
for (size_t i = 0; i < std::size(_s4.guests_in_park_history); i++)
|
||||
{
|
||||
gGuestsInParkHistory[i] = _s4.guests_in_park_history[i];
|
||||
if (_s4.guests_in_park_history[i] != std::numeric_limits<uint8_t>::max())
|
||||
{
|
||||
gGuestsInParkHistory[i] = _s4.guests_in_park_history[i] * 20;
|
||||
}
|
||||
}
|
||||
|
||||
// News items
|
||||
|
|
|
@ -264,7 +264,15 @@ public:
|
|||
gParkRating = _s6.park_rating;
|
||||
|
||||
std::memcpy(gParkRatingHistory, _s6.park_rating_history, sizeof(_s6.park_rating_history));
|
||||
std::memcpy(gGuestsInParkHistory, _s6.guests_in_park_history, sizeof(_s6.guests_in_park_history));
|
||||
|
||||
std::fill(std::begin(gGuestsInParkHistory), std::end(gGuestsInParkHistory), std::numeric_limits<uint32_t>::max());
|
||||
for (size_t i = 0; i < std::size(_s6.guests_in_park_history); i++)
|
||||
{
|
||||
if (_s6.guests_in_park_history[i] != std::numeric_limits<uint8_t>::max())
|
||||
{
|
||||
gGuestsInParkHistory[i] = _s6.guests_in_park_history[i] * 20;
|
||||
}
|
||||
}
|
||||
|
||||
gResearchPriorities = _s6.active_research_types;
|
||||
gResearchProgressStage = _s6.research_progress_stage;
|
||||
|
|
|
@ -61,7 +61,7 @@ money64 gCompanyValue;
|
|||
|
||||
int16_t gParkRatingCasualtyPenalty;
|
||||
uint8_t gParkRatingHistory[32];
|
||||
uint8_t gGuestsInParkHistory[32];
|
||||
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;
|
||||
|
@ -743,11 +743,8 @@ template<typename T, size_t TSize> static void HistoryPushRecord(T history[TSize
|
|||
|
||||
void Park::ResetHistories()
|
||||
{
|
||||
for (size_t i = 0; i < 32; i++)
|
||||
{
|
||||
gParkRatingHistory[i] = 255;
|
||||
gGuestsInParkHistory[i] = 255;
|
||||
}
|
||||
std::fill(std::begin(gParkRatingHistory), std::end(gParkRatingHistory), std::numeric_limits<uint8_t>::max());
|
||||
std::fill(std::begin(gGuestsInParkHistory), std::end(gGuestsInParkHistory), std::numeric_limits<uint32_t>::max());
|
||||
}
|
||||
|
||||
void Park::UpdateHistories()
|
||||
|
@ -767,7 +764,7 @@ void Park::UpdateHistories()
|
|||
|
||||
// Update park rating, guests in park and current cash history
|
||||
HistoryPushRecord<uint8_t, 32>(gParkRatingHistory, CalculateParkRating() / 4);
|
||||
HistoryPushRecord<uint8_t, 32>(gGuestsInParkHistory, std::min<uint16_t>(gNumGuestsInPark, 5000) / 20);
|
||||
HistoryPushRecord<uint32_t, 32>(gGuestsInParkHistory, gNumGuestsInPark);
|
||||
HistoryPushRecord<money64, std::size(gCashHistory)>(gCashHistory, finance_get_current_cash() - gBankLoan);
|
||||
|
||||
// Update weekly profit history
|
||||
|
|
|
@ -102,7 +102,7 @@ extern money64 gCompanyValue;
|
|||
|
||||
extern int16_t gParkRatingCasualtyPenalty;
|
||||
extern uint8_t gParkRatingHistory[32];
|
||||
extern uint8_t gGuestsInParkHistory[32];
|
||||
extern uint32_t gGuestsInParkHistory[32];
|
||||
extern int32_t _guestGenerationProbability;
|
||||
extern uint32_t _suggestedGuestMaximum;
|
||||
|
||||
|
|
Loading…
Reference in New Issue