add global macros: gLandPrice, gConstructionRightsPrice

This commit is contained in:
Ted John 2016-04-23 01:37:10 +01:00
parent 52804297a6
commit 2b702d89c6
5 changed files with 24 additions and 21 deletions

View File

@ -533,10 +533,10 @@ static int cc_get(const utf8 **argv, int argc)
console_printf("park_open %d", (gParkFlags & PARK_FLAGS_PARK_OPEN) != 0);
}
else if (strcmp(argv[0], "land_rights_cost") == 0) {
console_printf("land_rights_cost %d.%d0", RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) / 10, RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) % 10);
console_printf("land_rights_cost %d.%d0", gLandPrice / 10, gLandPrice % 10);
}
else if (strcmp(argv[0], "construction_rights_cost") == 0) {
console_printf("construction_rights_cost %d.%d0", RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money32) / 10, RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money32) % 10);
console_printf("construction_rights_cost %d.%d0", gConstructionRightsPrice / 10, gConstructionRightsPrice % 10);
}
else if (strcmp(argv[0], "climate") == 0) {
const utf8* climate_names[] = { "cool_and_wet", "warm", "hot_and_dry", "cold" };
@ -673,11 +673,11 @@ static int cc_set(const utf8 **argv, int argc)
console_execute_silent("get park_open");
}
else if (strcmp(argv[0], "land_rights_cost") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
gLandPrice = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
console_execute_silent("get land_rights_cost");
}
else if (strcmp(argv[0], "construction_rights_cost") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
gConstructionRightsPrice = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
console_execute_silent("get construction_rights_cost");
}
else if (strcmp(argv[0], "climate") == 0) {

View File

@ -653,8 +653,8 @@ void S4Importer::ImportMapAnimations()
void S4Importer::ImportFinance()
{
gParkEntranceFee = _s4.park_entrance_fee;
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) = _s4.land_price;
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) = _s4.construction_rights_price;
gLandPrice = _s4.land_price;
gConstructionRightsPrice = _s4.construction_rights_price;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, uint32) = ENCRYPT_MONEY(_s4.cash);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = _s4.loan;

View File

@ -980,32 +980,32 @@ static void window_editor_scenario_options_park_mousedown(int widgetIndex, rct_w
switch (widgetIndex) {
case WIDX_LAND_COST_INCREASE:
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) < MONEY(200,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) += MONEY(1,00);
if (gLandPrice < MONEY(200,00)) {
gLandPrice += MONEY(1,00);
} else {
window_error_open(3264, STR_NONE);
}
window_invalidate(w);
break;
case WIDX_LAND_COST_DECREASE:
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) > MONEY(5,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) -= MONEY(1,00);
if (gLandPrice > MONEY(5,00)) {
gLandPrice -= MONEY(1,00);
} else {
window_error_open(3265, STR_NONE);
}
window_invalidate(w);
break;
case WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE:
if (RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) < MONEY(200,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) += MONEY(1,00);
if (gConstructionRightsPrice < MONEY(200,00)) {
gConstructionRightsPrice += MONEY(1,00);
} else {
window_error_open(3264, STR_NONE);
}
window_invalidate(w);
break;
case WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE:
if (RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) > MONEY(5,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) -= MONEY(1,00);
if (gConstructionRightsPrice > MONEY(5,00)) {
gConstructionRightsPrice -= MONEY(1,00);
} else {
window_error_open(3265, STR_NONE);
}
@ -1191,7 +1191,7 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix
// Cost to buy land value
x = w->x + w->widgets[WIDX_LAND_COST].left + 1;
y = w->y + w->widgets[WIDX_LAND_COST].top;
arg = RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16);
arg = gLandPrice;
gfx_draw_string_left(dpi, 3246, &arg, 0, x, y);
}
@ -1204,7 +1204,7 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix
// Cost to buy construction rights value
x = w->x + w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].left + 1;
y = w->y + w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].top;
arg = RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16);
arg = gConstructionRightsPrice;
gfx_draw_string_left(dpi, 3246, &arg, 0, x, y);
}

View File

@ -114,8 +114,8 @@ void park_init()
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) = 1;
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) = 4;
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) = 1000;
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, uint16) = MONEY(90, 00);
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, uint16) = MONEY(40,00);
gLandPrice = MONEY(90, 00);
gConstructionRightsPrice = MONEY(40,00);
RCT2_GLOBAL(0x01358774, uint16) = 0;
gParkFlags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
park_reset_history();
@ -954,7 +954,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) {
update_park_fences(x, y + 32);
update_park_fences(x, y - 32);
}
return RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, uint16);
return gLandPrice;
case 1:
if (flags & GAME_COMMAND_FLAG_APPLY) {
surfaceElement->properties.surface.ownership &= ~(OWNERSHIP_OWNED | OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED);
@ -980,7 +980,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) {
uint16 baseHeight = surfaceElement->base_height * 8;
map_invalidate_tile(x, y, baseHeight, baseHeight + 16);
}
return RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, uint16);
return gConstructionRightsPrice;
case 3:
if (flags & GAME_COMMAND_FLAG_APPLY) {
surfaceElement->properties.surface.ownership &= ~OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED;
@ -1030,7 +1030,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) {
}
if (!(flags & GAME_COMMAND_FLAG_APPLY)) {
return RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, uint16);
return gLandPrice;
}
if ((newOwnership & 0xF0) != 0) {

View File

@ -53,6 +53,9 @@ enum {
#define gParkEntranceFee RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16)
#define gNumGuestsInPark RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)
#define gLandPrice RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16)
#define gConstructionRightsPrice RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16)
extern uint8 *gParkRatingHistory;
extern uint8 *gGuestsInParkHistory;
extern int _guestGenerationProbability;