mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 13:33:02 +01:00
add global macro for gCurrentExpenditure, gCurrentProfit
This commit is contained in:
@@ -64,7 +64,7 @@ void finance_payment(money32 amount, rct_expenditure_type type)
|
||||
gCashEncrypted = ENCRYPT_MONEY(new_money);
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_EXPENDITURE_TABLE, money32)[type] -= amount;
|
||||
if (dword_988E60[type] & 1)
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32) -= amount; // Cumulative amount of money spent this day
|
||||
gCurrentExpenditure -= amount; // Cumulative amount of money spent this day
|
||||
|
||||
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_MONEY;
|
||||
@@ -168,8 +168,8 @@ void finance_init() {
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_EXPENDITURE_TABLE, money32)[i] = 0;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, uint32) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) = 0;
|
||||
gCurrentExpenditure = 0;
|
||||
gCurrentProfit = 0;
|
||||
|
||||
RCT2_GLOBAL(0x01358334, money32) = 0;
|
||||
RCT2_GLOBAL(0x01358338, uint16) = 0;
|
||||
@@ -200,8 +200,8 @@ void finance_init() {
|
||||
*/
|
||||
void finance_update_daily_profit()
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) = 7 * RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32) = 0; // Reset daily expenditure
|
||||
gCurrentProfit = 7 * gCurrentExpenditure;
|
||||
gCurrentExpenditure = 0; // Reset daily expenditure
|
||||
|
||||
money32 current_profit = 0;
|
||||
|
||||
@@ -237,10 +237,10 @@ void finance_update_daily_profit()
|
||||
// This is not equivalent to / 4 due to rounding of negative numbers
|
||||
current_profit = current_profit >> 2;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) += current_profit;
|
||||
gCurrentProfit += current_profit;
|
||||
|
||||
// These are related to weekly profit graph
|
||||
RCT2_GLOBAL(0x1358334, money32) += RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32);
|
||||
RCT2_GLOBAL(0x1358334, money32) += gCurrentProfit;
|
||||
RCT2_GLOBAL(0x1358338, uint16) += 1;
|
||||
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
|
||||
@@ -47,6 +47,8 @@ enum {
|
||||
#define gBankLoan RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32)
|
||||
#define gBankLoanInterestRate RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, sint8)
|
||||
#define gMaxBankLoan RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32)
|
||||
#define gCurrentExpenditure RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32)
|
||||
#define gCurrentProfit RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32)
|
||||
|
||||
extern const money32 research_cost_table[4];
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ void S4Importer::ImportFinance()
|
||||
|
||||
gCompanyValue = _s4.company_value;
|
||||
gParkValue = _s4.park_value;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) = _s4.profit;
|
||||
gCurrentProfit = _s4.profit;
|
||||
|
||||
for (int i = 0; i < 128; i++)
|
||||
{
|
||||
@@ -698,7 +698,7 @@ void S4Importer::ImportFinance()
|
||||
{
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_EXPENDITURE_TABLE, money32)[i] = _s4.expenditure[i];
|
||||
}
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32) = _s4.total_expenditure;
|
||||
gCurrentExpenditure = _s4.total_expenditure;
|
||||
|
||||
gTotalAdmissions = _s4.num_admissions;
|
||||
gTotalIncomeFromAdmissions = _s4.admission_total_income;
|
||||
|
||||
@@ -329,8 +329,8 @@ void S6Exporter::Export()
|
||||
|
||||
memcpy(_s6.balance_history, gCashHistory, sizeof(_s6.balance_history));
|
||||
|
||||
_s6.current_expenditure = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32);
|
||||
_s6.current_profit = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32);
|
||||
_s6.current_expenditure = gCurrentExpenditure;
|
||||
_s6.current_profit = gCurrentProfit;
|
||||
_s6.dword_01358334 = RCT2_GLOBAL(0x01358334, uint32);
|
||||
_s6.word_01358338 = RCT2_GLOBAL(0x01358338, uint16);
|
||||
// pad_0135833A
|
||||
|
||||
@@ -261,8 +261,8 @@ void S6Importer::Import()
|
||||
|
||||
memcpy(gCashHistory, _s6.balance_history, sizeof(_s6.balance_history));
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32) = _s6.current_expenditure;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) = _s6.current_profit;
|
||||
gCurrentExpenditure = _s6.current_expenditure;
|
||||
gCurrentProfit = _s6.current_profit;
|
||||
RCT2_GLOBAL(0x01358334, uint32) = _s6.dword_01358334;
|
||||
RCT2_GLOBAL(0x01358338, uint16) = _s6.word_01358338;
|
||||
// pad_0135833A
|
||||
|
||||
@@ -233,8 +233,8 @@ void scenario_begin()
|
||||
strcat((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, ".SV6");
|
||||
|
||||
memset((void*)0x001357848, 0, 56);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, uint32) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) = 0;
|
||||
gCurrentExpenditure = 0;
|
||||
gCurrentProfit = 0;
|
||||
RCT2_GLOBAL(0x01358334, money32) = 0;
|
||||
RCT2_GLOBAL(0x01358338, uint16) = 0;
|
||||
gScenarioCompletedCompanyValue = MONEY32_UNDEFINED;
|
||||
|
||||
@@ -1035,7 +1035,7 @@ static void window_finances_profit_graph_paint(rct_window *w, rct_drawpixelinfo
|
||||
graphBottom = w->y + pageWidget->bottom - 4;
|
||||
|
||||
// Weekly profit
|
||||
money32 weeklyPofit = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32);
|
||||
money32 weeklyPofit = gCurrentProfit;
|
||||
gfx_draw_string_left(
|
||||
dpi,
|
||||
weeklyPofit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS,
|
||||
|
||||
@@ -217,7 +217,7 @@ static void window_game_bottom_toolbar_tooltip(rct_window* w, int widgetIndex, r
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_MONEY:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, sint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = gCurrentProfit;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, int) = gParkValue;
|
||||
break;
|
||||
case WIDX_PARK_RATING:
|
||||
|
||||
Reference in New Issue
Block a user