diff --git a/src/editor.c b/src/editor.c index b521c423bd..0da0a2209c 100644 --- a/src/editor.c +++ b/src/editor.c @@ -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(); diff --git a/src/interface/console.c b/src/interface/console.c index dd4977e0bd..cf09712b2f 100644 --- a/src/interface/console.c +++ b/src/interface/console.c @@ -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])) { diff --git a/src/peep/peep.c b/src/peep/peep.c index d0d5b491dc..2399385ba3 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -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; } diff --git a/src/peep/peep.h b/src/peep/peep.h index 75bd863297..d79b05db29 100644 --- a/src/peep/peep.h +++ b/src/peep/peep.h @@ -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(); diff --git a/src/rct1/S4Importer.cpp b/src/rct1/S4Importer.cpp index 4c0f5a2e52..db29354373 100644 --- a/src/rct1/S4Importer.cpp +++ b/src/rct1/S4Importer.cpp @@ -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; diff --git a/src/windows/editor_scenario_options.c b/src/windows/editor_scenario_options.c index 744615ef09..b81997e02c 100644 --- a/src/windows/editor_scenario_options.c +++ b/src/windows/editor_scenario_options.c @@ -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); } diff --git a/src/world/park.c b/src/world/park.c index 248524130c..fa63e16a3e 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -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;