mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
Implement ride upkeep payments
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "sprite.h"
|
||||
#include "park.h"
|
||||
#include "peep.h"
|
||||
#include "ride.h"
|
||||
#include "window.h"
|
||||
|
||||
// monthly cost
|
||||
@@ -102,6 +103,35 @@ void finance_pay_interest()
|
||||
finance_payment((sint32)tempcost, RCT_EXPENDITURE_TYPE_INTEREST);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006AC885
|
||||
*/
|
||||
void finance_pay_ride_upkeep()
|
||||
{
|
||||
rct_ride* ride;
|
||||
for (int i = 0; i < 255; i++) {
|
||||
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
continue;
|
||||
|
||||
if (!(ride->var_1D0 & 0x1000)) {
|
||||
ride->build_date = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
|
||||
ride->var_196 = 25855; // durability?
|
||||
|
||||
}
|
||||
if (ride->status != RIDE_STATUS_CLOSED && !(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800)) {
|
||||
sint16 upkeep = ride->upkeep_cost;
|
||||
if (upkeep != -1) {
|
||||
ride->var_158 -= upkeep;
|
||||
ride->var_14D |= 2;
|
||||
finance_payment(upkeep, RCT2_EXPENDITURE_TYPE_RIDE_UPKEEP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0069DEFB
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
typedef int rct_expenditure_type;
|
||||
|
||||
enum {
|
||||
RCT2_EXPENDITURE_TYPE_RIDE_UPKEEP = 1,
|
||||
RCT_EXPENDITURE_TYPE_WAGES = 10,
|
||||
RCT_EXPENDITURE_TYPE_RESEARCH = 12,
|
||||
RCT_EXPENDITURE_TYPE_INTEREST = 13
|
||||
@@ -38,6 +39,7 @@ void finance_payment(int amount, rct_expenditure_type type);
|
||||
void finance_pay_wages();
|
||||
void finance_pay_research();
|
||||
void finance_pay_interest();
|
||||
void finance_pay_ride_upkeep();
|
||||
void finance_init();
|
||||
|
||||
#endif
|
||||
@@ -74,7 +74,8 @@ typedef struct {
|
||||
uint16 var_158;
|
||||
uint8 pad_15A[0x26];
|
||||
uint16 build_date;
|
||||
uint8 pad_182[0x14];
|
||||
sint16 upkeep_cost; // 0x182
|
||||
uint8 pad_184[0x12];
|
||||
uint16 var_196;
|
||||
uint8 pad_198;
|
||||
uint8 var_199;
|
||||
|
||||
@@ -893,8 +893,8 @@ void scenario_update()
|
||||
|
||||
//if ( (unsigned int)((2 * current_day) & 0xFFFF) >= 0xFFF8) {
|
||||
if (next_month_tick % 0x8000 == 0) {
|
||||
// biweekly checks
|
||||
RCT2_CALLPROC_EBPSAFE(0x006AC885);
|
||||
// fortnightly
|
||||
finance_pay_ride_upkeep();
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) = next_month_tick;
|
||||
|
||||
Reference in New Issue
Block a user