1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Finance: remove pre-gamestate accessor functions

This commit is contained in:
Aaron van Geffen
2025-09-12 12:46:24 +02:00
parent 531cb68727
commit b869134e72
3 changed files with 2 additions and 27 deletions

View File

@@ -307,26 +307,6 @@ void FinanceUpdateDailyProfit()
windowMgr->InvalidateByClass(WindowClass::Finances);
}
money64 FinanceGetInitialCash()
{
return getGameState().scenarioOptions.initialCash;
}
money64 FinanceGetCurrentLoan()
{
return getGameState().park.bankLoan;
}
money64 FinanceGetMaximumLoan()
{
return getGameState().park.maxBankLoan;
}
money64 FinanceGetCurrentCash()
{
return getGameState().park.cash;
}
/**
* Shift the expenditure table history one month to the left
* If the table is full, accumulate the sum of the oldest month first

View File

@@ -51,9 +51,4 @@ void FinanceUpdateDailyProfit();
void FinanceShiftExpenditureTable();
void FinanceResetCashToInitial();
money64 FinanceGetInitialCash();
money64 FinanceGetCurrentLoan();
money64 FinanceGetMaximumLoan();
money64 FinanceGetCurrentCash();
money64 FinanceGetLastMonthShopProfit();

View File

@@ -533,7 +533,7 @@ namespace OpenRCT2::Park
auto result = park.value - park.bankLoan;
// Clamp addition to prevent overflow
result = AddClamp<money64>(result, FinanceGetCurrentCash());
result = AddClamp<money64>(result, park.cash);
return result;
}
@@ -611,7 +611,7 @@ namespace OpenRCT2::Park
HistoryPushRecord<uint32_t, numGuestsHistorySize>(park.guestsInParkHistory, park.numGuestsInPark);
constexpr auto cashHistorySize = std::extent_v<decltype(ParkData::cashHistory)>;
HistoryPushRecord<money64, cashHistorySize>(park.cashHistory, FinanceGetCurrentCash() - park.bankLoan);
HistoryPushRecord<money64, cashHistorySize>(park.cashHistory, park.cash - park.bankLoan);
// Update weekly profit history
auto currentWeeklyProfit = park.weeklyProfitAverageDividend;