add global macro: gGuestInitialCash

This commit is contained in:
Ted John 2016-04-23 02:35:03 +01:00
parent 66855e41e5
commit 8509927dc7
7 changed files with 15 additions and 17 deletions

View File

@ -450,11 +450,7 @@ static void editor_clear_map_for_editing()
gParkFlags &= ~PARK_FLAGS_18;
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) = clamp(
MONEY(10,00),
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16),
MONEY(100,00)
);
gGuestInitialCash = clamp(MONEY(10,00), gGuestInitialCash, MONEY(100,00));
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, uint32) = min(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, uint32), 100000);
finance_reset_cash_to_initial();

View File

@ -480,7 +480,7 @@ static int cc_get(const utf8 **argv, int argc)
console_printf("max_loan %d", RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) / 10);
}
else if (strcmp(argv[0], "guest_initial_cash") == 0) {
console_printf("guest_initial_cash %d.%d0", RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) / 10, RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) % 10);
console_printf("guest_initial_cash %d.%d0", gGuestInitialCash / 10, gGuestInitialCash % 10);
}
else if (strcmp(argv[0], "guest_initial_happiness") == 0) {
uint32 current_happiness = RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8);
@ -614,7 +614,7 @@ static int cc_set(const utf8 **argv, int argc)
console_execute_silent("get max_loan");
}
else if (strcmp(argv[0], "guest_initial_cash") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(1000, 0));
gGuestInitialCash = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(1000, 0));
console_execute_silent("get guest_initial_cash");
}
else if (strcmp(argv[0], "guest_initial_happiness") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {

View File

@ -6143,10 +6143,10 @@ rct_peep *peep_generate(int x, int y, int z)
peep->id = RCT2_GLOBAL(0x013B0E6C, uint32)++;
peep->name_string_idx = 767;
money32 cash = (scenario_rand() & 0x3) * 100 - 100 + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16);
money32 cash = (scenario_rand() & 0x3) * 100 - 100 + gGuestInitialCash;
if (cash < 0) cash = 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) == 0){
if (gGuestInitialCash == 0){
cash = 500;
}
@ -6154,7 +6154,7 @@ rct_peep *peep_generate(int x, int y, int z)
cash = 0;
}
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) == (money16)0xFFFF){
if (gGuestInitialCash == (money16)0xFFFF){
cash = 0;
}

View File

@ -599,6 +599,8 @@ enum {
FOR_ALL_PEEPS(sprite_index, peep) \
if (peep->type == PEEP_TYPE_STAFF)
#define gGuestInitialCash RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16)
int peep_get_staff_count();
int peep_can_be_picked_up(rct_peep* peep);
void peep_update_all();

View File

@ -958,7 +958,7 @@ void S4Importer::ImportParkFlags()
}
// Initial guest status
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) = _s4.guest_initial_cash;
gGuestInitialCash = _s4.guest_initial_cash;
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) = _s4.guest_initial_hunger;
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) = _s4.guest_initial_thirst;

View File

@ -737,16 +737,16 @@ static void window_editor_scenario_options_guests_mousedown(int widgetIndex, rct
{
switch (widgetIndex) {
case WIDX_CASH_PER_GUEST_INCREASE:
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) < MONEY(1000, 00)) {
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) += MONEY(1, 00);
if (gGuestInitialCash < MONEY(1000, 00)) {
gGuestInitialCash += MONEY(1, 00);
} else {
window_error_open(3264, STR_NONE);
}
window_invalidate(w);
break;
case WIDX_CASH_PER_GUEST_DECREASE:
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) > MONEY(0, 00)) {
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) -= MONEY(1, 00);
if (gGuestInitialCash > MONEY(0, 00)) {
gGuestInitialCash -= MONEY(1, 00);
} else {
window_error_open(3265, STR_NONE);
}
@ -881,7 +881,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp
// Cash per guest value
x = w->x + w->widgets[WIDX_CASH_PER_GUEST].left + 1;
y = w->y + w->widgets[WIDX_CASH_PER_GUEST].top;
arg = RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16);
arg = gGuestInitialCash;
gfx_draw_string_left(dpi, 3246, &arg, 0, x, y);
}

View File

@ -107,7 +107,7 @@ void park_init()
RCT2_GLOBAL(RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES, uint16) = 127;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2;
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, uint16) = MONEY(50,00); // Cash per guest (average)
gGuestInitialCash = MONEY(50,00); // Cash per guest (average)
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) = calculate_guest_initial_happiness(50); // 50%
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) = 200;
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) = 200;