1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 14:02:59 +01:00

Get size of WeeklyProfitHistory in compile time

This commit is contained in:
Hielke Morsink
2024-01-25 12:33:02 +01:00
parent 99e1746eda
commit 1f8b7950bc

View File

@@ -773,13 +773,14 @@ void Park::UpdateHistories()
{
currentWeeklyProfit /= gameState.WeeklyProfitAverageDivisor;
}
HistoryPushRecord<money64, FINANCE_GRAPH_SIZE>(gameState.WeeklyProfitHistory, currentWeeklyProfit);
constexpr auto profitHistorySize = std::extent_v<decltype(GameState_t::WeeklyProfitHistory)>;
HistoryPushRecord<money64, profitHistorySize>(gameState.WeeklyProfitHistory, currentWeeklyProfit);
gameState.WeeklyProfitAverageDividend = 0;
gameState.WeeklyProfitAverageDivisor = 0;
// Update park value history
HistoryPushRecord<money64, std::extent_v<decltype(GameState_t::ParkValueHistory)>>(
gameState.ParkValueHistory, gameState.ParkValue);
constexpr auto parkValueHistorySize = std::extent_v<decltype(GameState_t::WeeklyProfitHistory)>;
HistoryPushRecord<money64, parkValueHistorySize>(gameState.ParkValueHistory, gameState.ParkValue);
// Invalidate relevant windows
auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT);