From 3c3a37073d95c6c3bf744146bbdf62884de64fc4 Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 9 May 2016 21:18:44 +0100 Subject: [PATCH] add global macro for gSamePriceThroughoutPark --- src/rct2/S6Exporter.cpp | 4 ++-- src/rct2/S6Importer.cpp | 4 ++-- src/ride/ride.c | 4 ++-- src/ride/ride.h | 4 +++- src/windows/ride.c | 8 ++++---- src/world/park.c | 4 ++-- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/rct2/S6Exporter.cpp b/src/rct2/S6Exporter.cpp index 6368549171..cd57bf8453 100644 --- a/src/rct2/S6Exporter.cpp +++ b/src/rct2/S6Exporter.cpp @@ -367,7 +367,7 @@ void S6Exporter::Export() _s6.map_size_minus_2 = gMapSizeMinus2; _s6.map_size = gMapSize; _s6.map_max_xy = gMapSizeMaxXY; - _s6.same_price_throughout = RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT, uint32); + _s6.same_price_throughout = gSamePriceThroughoutParkA; _s6.suggested_max_guests = _suggestedGuestMaximum; _s6.park_rating_warning_days = gScenarioParkRatingWarningDays; _s6.last_entrance_style = RCT2_GLOBAL(RCT2_ADDRESS_LAST_ENTRANCE_STYLE, uint8); @@ -379,7 +379,7 @@ void S6Exporter::Export() memcpy(_s6.scenario_description, gScenarioDetails, sizeof(_s6.scenario_description)); _s6.current_interest_rate = gBankLoanInterestRate; // pad_0135934B - _s6.same_price_throughout_extended = RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT_EXTENDED, uint32); + _s6.same_price_throughout_extended = gSamePriceThroughoutParkB; memcpy(_s6.park_entrance_x, gParkEntranceX, sizeof(_s6.park_entrance_x)); memcpy(_s6.park_entrance_y, gParkEntranceY, sizeof(_s6.park_entrance_y)); memcpy(_s6.park_entrance_z, gParkEntranceZ, sizeof(_s6.park_entrance_z)); diff --git a/src/rct2/S6Importer.cpp b/src/rct2/S6Importer.cpp index 2893e4db26..59a3ed6af2 100644 --- a/src/rct2/S6Importer.cpp +++ b/src/rct2/S6Importer.cpp @@ -299,7 +299,7 @@ void S6Importer::Import() gMapSizeMinus2 = _s6.map_size_minus_2; gMapSize = _s6.map_size; gMapSizeMaxXY = _s6.map_max_xy; - RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT, uint32) = _s6.same_price_throughout; + gSamePriceThroughoutParkA = _s6.same_price_throughout; _suggestedGuestMaximum = _s6.suggested_max_guests; gScenarioParkRatingWarningDays = _s6.park_rating_warning_days; RCT2_GLOBAL(RCT2_ADDRESS_LAST_ENTRANCE_STYLE, uint8) = _s6.last_entrance_style; @@ -311,7 +311,7 @@ void S6Importer::Import() memcpy(gScenarioDetails, _s6.scenario_description, sizeof(_s6.scenario_description)); gBankLoanInterestRate = _s6.current_interest_rate; // pad_0135934B - RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT_EXTENDED, uint32) = _s6.same_price_throughout_extended; + gSamePriceThroughoutParkB = _s6.same_price_throughout_extended; memcpy(gParkEntranceX, _s6.park_entrance_x, sizeof(_s6.park_entrance_x)); memcpy(gParkEntranceY, _s6.park_entrance_y, sizeof(_s6.park_entrance_y)); memcpy(gParkEntranceZ, _s6.park_entrance_z, sizeof(_s6.park_entrance_z)); diff --git a/src/ride/ride.c b/src/ride/ride.c index 8bca60adbd..c40db6fdd8 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -5850,9 +5850,9 @@ static money32 shop_item_get_common_price(rct_ride *forRide, int shopItem) bool shop_item_has_common_price(int shopItem) { if (shopItem < 32) { - return RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT, uint32) & (1u << shopItem); + return gSamePriceThroughoutParkA & (1u << shopItem); } else { - return RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT_EXTENDED, uint32) & (1u << (shopItem - 32)); + return gSamePriceThroughoutParkB & (1u << (shopItem - 32)); } } diff --git a/src/ride/ride.h b/src/ride/ride.h index 0e64071829..529f0f34d3 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -884,7 +884,9 @@ rct_ride_measurement *get_ride_measurement(int index); for (i = 0; i < MAX_RIDES; i++) \ if ((ride = get_ride(i))->type != RIDE_TYPE_NULL) -#define gTotalRideValue RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) +#define gTotalRideValue RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) +#define gSamePriceThroughoutParkA RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT, uint32) +#define gSamePriceThroughoutParkB RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT_EXTENDED, uint32) extern const uint8 gRideClassifications[255]; diff --git a/src/windows/ride.c b/src/windows/ride.c index ef9c8abd07..a96b869aae 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -5433,22 +5433,22 @@ static void update_same_price_throughout_flags(uint32 shop_item) uint32 newFlags; if (shop_item == SHOP_ITEM_PHOTO || shop_item == SHOP_ITEM_PHOTO2 || shop_item == SHOP_ITEM_PHOTO3 || shop_item == SHOP_ITEM_PHOTO4) { - newFlags = RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT, uint32); + newFlags = gSamePriceThroughoutParkA; newFlags ^= (1 << SHOP_ITEM_PHOTO); game_do_command(0, 1, 0, (0x2 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); - newFlags = RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT_EXTENDED, uint32); + newFlags = gSamePriceThroughoutParkB; newFlags ^= (SHOP_ITEM_PHOTO2 - 32) | (SHOP_ITEM_PHOTO3 - 32) | (SHOP_ITEM_PHOTO4 - 32); game_do_command(0, 1, 0, (0x3 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); } else { if (shop_item < 32) { - newFlags = RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT, uint32); + newFlags = gSamePriceThroughoutParkA; newFlags ^= (1u << shop_item); game_do_command(0, 1, 0, (0x2 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); } else { - newFlags = RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT_EXTENDED, uint32); + newFlags = gSamePriceThroughoutParkB; newFlags ^= (1u << (shop_item - 32)); game_do_command(0, 1, 0, (0x3 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); } diff --git a/src/world/park.c b/src/world/park.c index 725446b0b3..a8e7024be6 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -697,11 +697,11 @@ void game_command_set_park_open(int* eax, int* ebx, int* ecx, int* edx, int* esi } break; case 2: - RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT, uint32) = *edi; + gSamePriceThroughoutParkA = *edi; window_invalidate_by_class(WC_RIDE); break; case 3: - RCT2_GLOBAL(RCT2_ADDRESS_SAME_PRICE_THROUGHOUT_EXTENDED, uint32) = *edi; + gSamePriceThroughoutParkB = *edi; window_invalidate_by_class(WC_RIDE); break; }