1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 17:42:29 +01:00

Move gCurrentExpenditure to GameState_t

This commit is contained in:
Harry Hopkinson
2024-02-27 21:03:40 +00:00
committed by GitHub
parent 57a4c83f80
commit 063c4f7bce
7 changed files with 10 additions and 11 deletions

View File

@@ -42,6 +42,7 @@ namespace OpenRCT2
money64 ParkValueHistory[FINANCE_GRAPH_SIZE];
money64 CompanyValue;
money64 ConstructionRightsPrice;
money64 CurrentExpenditure;
uint8_t ParkRatingHistory[32];
ClimateType Climate;
ClimateState ClimateCurrent;

View File

@@ -39,7 +39,6 @@ static constexpr int32_t dword_988E60[static_cast<int32_t>(ExpenditureType::Coun
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0,
};
money64 gCurrentExpenditure;
money64 gCurrentProfit;
money64 gHistoricalProfit;
money64 gCashHistory[FINANCE_GRAPH_SIZE];
@@ -88,7 +87,7 @@ void FinancePayment(money64 amount, ExpenditureType type)
if (dword_988E60[static_cast<int32_t>(type)] & 1)
{
// Cumulative amount of money spent this day
gCurrentExpenditure -= amount;
gameState.CurrentExpenditure -= amount;
}
auto intent = Intent(INTENT_ACTION_UPDATE_CASH);
@@ -220,7 +219,7 @@ void FinanceInit()
gExpenditureTable[0][i] = 0;
}
gCurrentExpenditure = 0;
gameState.CurrentExpenditure = 0;
gCurrentProfit = 0;
gameState.WeeklyProfitAverageDividend = 0;
@@ -250,12 +249,12 @@ void FinanceInit()
void FinanceUpdateDailyProfit()
{
PROFILED_FUNCTION();
auto& gameState = GetGameState();
gCurrentProfit = 7 * gCurrentExpenditure;
gCurrentExpenditure = 0; // Reset daily expenditure
gCurrentProfit = 7 * gameState.CurrentExpenditure;
gameState.CurrentExpenditure = 0; // Reset daily expenditure
money64 current_profit = 0;
auto& gameState = GetGameState();
if (!(gameState.ParkFlags & PARK_FLAGS_NO_MONEY))
{

View File

@@ -38,7 +38,6 @@ constexpr uint8_t MaxBankLoanInterestRate = 255;
extern const money64 research_cost_table[RESEARCH_FUNDING_COUNT];
extern money64 gCurrentExpenditure;
extern money64 gCurrentProfit;
/**

View File

@@ -891,7 +891,7 @@ namespace OpenRCT2
cs.ReadWrite(gameState.NumGuestsHeadingForPark);
cs.ReadWrite(gameState.ParkRating);
cs.ReadWrite(gParkRatingCasualtyPenalty);
cs.ReadWrite(gCurrentExpenditure);
cs.ReadWrite(gameState.CurrentExpenditure);
cs.ReadWrite(gCurrentProfit);
cs.ReadWrite(gameState.WeeklyProfitAverageDividend);
cs.ReadWrite(gameState.WeeklyProfitAverageDivisor);

View File

@@ -1420,7 +1420,7 @@ namespace RCT1
gExpenditureTable[i][j] = ToMoney64(_s4.Expenditure[i][j]);
}
}
gCurrentExpenditure = ToMoney64(_s4.TotalExpenditure);
gameState.CurrentExpenditure = ToMoney64(_s4.TotalExpenditure);
gameState.ScenarioCompletedCompanyValue = RCT12CompletedCompanyValueToOpenRCT2(_s4.CompletedCompanyValue);
gameState.TotalAdmissions = _s4.NumAdmissions;

View File

@@ -356,7 +356,7 @@ namespace RCT2
gameState.ScenarioObjective.NumGuests = _s6.ObjectiveGuests;
ImportMarketingCampaigns();
gCurrentExpenditure = ToMoney64(_s6.CurrentExpenditure);
gameState.CurrentExpenditure = ToMoney64(_s6.CurrentExpenditure);
gCurrentProfit = ToMoney64(_s6.CurrentProfit);
gameState.WeeklyProfitAverageDividend = ToMoney64(_s6.WeeklyProfitAverageDividend);
gameState.WeeklyProfitAverageDivisor = _s6.WeeklyProfitAverageDivisor;

View File

@@ -134,7 +134,7 @@ void ScenarioReset(GameState_t& gameState)
auto savePath = env->GetDirectoryPath(DIRBASE::USER, DIRID::SAVE);
gScenarioSavePath = Path::Combine(savePath, park.Name + u8".park");
gCurrentExpenditure = 0;
gameState.CurrentExpenditure = 0;
gCurrentProfit = 0;
gameState.WeeklyProfitAverageDividend = 0;
gameState.WeeklyProfitAverageDivisor = 0;