1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

add globals for gWeeklyProfitAverage...

This commit is contained in:
Ted John
2016-05-11 19:41:20 +01:00
parent 0f1028c92c
commit 30a044ae72
8 changed files with 30 additions and 24 deletions

View File

@@ -370,6 +370,9 @@
#define RCT2_ADDRESS_RIDE_COUNT 0x013587C8
#define RCT2_ADDRESS_RIDE_FLAGS 0x0097CF40
#define RCT2_ADDRESS_WEEKLY_PROFIT_AVERAGE_DIVIDEND 0x01358334
#define RCT2_ADDRESS_WEEKLY_PROFIT_AVERAGE_DIVISOR 0x01358338
//How many ticks the scenario has existed for
#define RCT2_ADDRESS_SAVED_AGE 0x01388698
#define RCT2_ADDRESS_SAVED_VIEW_X 0x0138869A

View File

@@ -172,8 +172,8 @@ void finance_init() {
gCurrentExpenditure = 0;
gCurrentProfit = 0;
RCT2_GLOBAL(0x01358334, money32) = 0;
RCT2_GLOBAL(0x01358338, uint16) = 0;
gWeeklyProfitAverageDividend = 0;
gWeeklyProfitAverageDivisor = 0;
gInitialCash = MONEY(10000,00); // Cheat detection
@@ -241,8 +241,8 @@ void finance_update_daily_profit()
gCurrentProfit += current_profit;
// These are related to weekly profit graph
RCT2_GLOBAL(0x1358334, money32) += gCurrentProfit;
RCT2_GLOBAL(0x1358338, uint16) += 1;
gWeeklyProfitAverageDividend += gCurrentProfit;
gWeeklyProfitAverageDivisor += 1;
window_invalidate_by_class(WC_FINANCES);
}

View File

@@ -42,13 +42,15 @@ enum {
#define EXPENDITURE_TABLE_MONTH_COUNT 16
#define EXPENDITURE_TABLE_TOTAL_COUNT (EXPENDITURE_TABLE_MONTH_COUNT * RCT_EXPENDITURE_TYPE_COUNT)
#define gInitialCash RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32)
#define gCashEncrypted RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)
#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)
#define gInitialCash RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32)
#define gCashEncrypted RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)
#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)
#define gWeeklyProfitAverageDividend RCT2_GLOBAL(RCT2_ADDRESS_WEEKLY_PROFIT_AVERAGE_DIVIDEND, money32)
#define gWeeklyProfitAverageDivisor RCT2_GLOBAL(RCT2_ADDRESS_WEEKLY_PROFIT_AVERAGE_DIVISOR, uint16)
extern const money32 research_cost_table[4];

View File

@@ -325,8 +325,8 @@ void S6Exporter::Export()
_s6.current_expenditure = gCurrentExpenditure;
_s6.current_profit = gCurrentProfit;
_s6.dword_01358334 = RCT2_GLOBAL(0x01358334, uint32);
_s6.word_01358338 = RCT2_GLOBAL(0x01358338, uint16);
_s6.weekly_profit_average_dividend = gWeeklyProfitAverageDividend;
_s6.weekly_profit_average_divisor = gWeeklyProfitAverageDivisor;
// pad_0135833A
memcpy(_s6.weekly_profit_history, gWeeklyProfitHistory, sizeof(_s6.weekly_profit_history));

View File

@@ -257,8 +257,8 @@ void S6Importer::Import()
gCurrentExpenditure = _s6.current_expenditure;
gCurrentProfit = _s6.current_profit;
RCT2_GLOBAL(0x01358334, uint32) = _s6.dword_01358334;
RCT2_GLOBAL(0x01358338, uint16) = _s6.word_01358338;
gWeeklyProfitAverageDividend = _s6.weekly_profit_average_dividend;
gWeeklyProfitAverageDivisor = _s6.weekly_profit_average_divisor;
// pad_0135833A
memcpy(gWeeklyProfitHistory, _s6.weekly_profit_history, sizeof(_s6.weekly_profit_history));

View File

@@ -235,8 +235,8 @@ void scenario_begin()
memset((void*)0x001357848, 0, 56);
gCurrentExpenditure = 0;
gCurrentProfit = 0;
RCT2_GLOBAL(0x01358334, money32) = 0;
RCT2_GLOBAL(0x01358338, uint16) = 0;
gWeeklyProfitAverageDividend = 0;
gWeeklyProfitAverageDivisor = 0;
gScenarioCompletedCompanyValue = MONEY32_UNDEFINED;
gTotalAdmissions = 0;
gTotalIncomeFromAdmissions = 0;

View File

@@ -217,8 +217,8 @@ typedef struct {
// SC6[11]
money32 current_expenditure;
money32 current_profit;
uint32 dword_01358334;
uint16 word_01358338;
uint32 weekly_profit_average_dividend;
uint16 weekly_profit_average_divisor;
uint8 pad_0135833A[2];
// Ignored in scenario

View File

@@ -628,16 +628,17 @@ void park_update_histories()
window_invalidate_by_class(WC_FINANCES);
// Update weekly profit history
money32 currentWeeklyProfit = RCT2_GLOBAL(0x01358334, money32);
if (RCT2_GLOBAL(0x01358338, uint16) != 0)
currentWeeklyProfit /= RCT2_GLOBAL(0x01358338, uint16);
money32 currentWeeklyProfit = gWeeklyProfitAverageDividend;
if (gWeeklyProfitAverageDivisor != 0) {
currentWeeklyProfit /= gWeeklyProfitAverageDivisor;
}
for (int i = 127; i > 0; i--)
gWeeklyProfitHistory[i] = gWeeklyProfitHistory[i - 1];
gWeeklyProfitHistory[0] = currentWeeklyProfit;
RCT2_GLOBAL(0x01358334, money32) = 0;
RCT2_GLOBAL(0x01358338, uint16) = 0;
gWeeklyProfitAverageDividend = 0;
gWeeklyProfitAverageDivisor = 0;
window_invalidate_by_class(WC_FINANCES);
// Update park value history