1 /*****************************************************************************
2  * Copyright (c) 2014-2020 OpenRCT2 developers
3  *
4  * For a complete list of all authors, please refer to contributors.md
5  * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
6  *
7  * OpenRCT2 is licensed under the GNU General Public License version 3.
8  *****************************************************************************/
9 
10 #pragma once
11 
12 #include "../common.h"
13 #include "Research.h"
14 
15 enum class ExpenditureType : int32_t
16 {
17     RideConstruction = 0,
18     RideRunningCosts,
19     LandPurchase,
20     Landscaping,
21     ParkEntranceTickets,
22     ParkRideTickets,
23     ShopSales,
24     ShopStock,
25     FoodDrinkSales,
26     FoodDrinkStock,
27     Wages,
28     Marketing,
29     Research,
30     Interest,
31     Count
32 };
33 
34 #define EXPENDITURE_TABLE_MONTH_COUNT 16
35 #define FINANCE_GRAPH_SIZE 128
36 
37 extern const money32 research_cost_table[RESEARCH_FUNDING_COUNT];
38 
39 extern money64 gInitialCash;
40 extern money64 gCash;
41 extern money64 gBankLoan;
42 extern uint8_t gBankLoanInterestRate;
43 extern money64 gMaxBankLoan;
44 extern money64 gCurrentExpenditure;
45 extern money64 gCurrentProfit;
46 
47 /**
48  * The total profit for the entire scenario that precedes
49  * the current financial table.
50  */
51 extern money64 gHistoricalProfit;
52 
53 extern money64 gWeeklyProfitAverageDividend;
54 extern uint16_t gWeeklyProfitAverageDivisor;
55 extern money64 gCashHistory[FINANCE_GRAPH_SIZE];
56 extern money64 gWeeklyProfitHistory[FINANCE_GRAPH_SIZE];
57 extern money64 gParkValueHistory[FINANCE_GRAPH_SIZE];
58 extern money64 gExpenditureTable[EXPENDITURE_TABLE_MONTH_COUNT][static_cast<int32_t>(ExpenditureType::Count)];
59 
60 bool finance_check_money_required(uint32_t flags);
61 bool finance_check_affordability(money32 cost, uint32_t flags);
62 void finance_payment(money32 amount, ExpenditureType type);
63 void finance_pay_wages();
64 void finance_pay_research();
65 void finance_pay_interest();
66 void finance_pay_ride_upkeep();
67 void finance_reset_history();
68 void finance_init();
69 void finance_update_daily_profit();
70 void finance_shift_expenditure_table();
71 void finance_reset_cash_to_initial();
72 
73 money64 finance_get_initial_cash();
74 money64 finance_get_current_loan();
75 money64 finance_get_maximum_loan();
76 money64 finance_get_current_cash();
77 
78 money64 finance_get_last_month_shop_profit();
79