add global macro: gTotalRideValue

This commit is contained in:
Ted John 2016-04-24 10:36:56 +01:00
parent 0a80e7a737
commit bac5538178
4 changed files with 15 additions and 11 deletions

View File

@ -164,9 +164,9 @@ static int award_is_deserved_best_value(int awardType, int activeAwardTypes)
return 0;
if (gParkFlags & (PARK_FLAGS_NO_MONEY | PARK_FLAGS_PARK_FREE_ENTRY))
return 0;
if (RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) < MONEY(10, 00))
if (gTotalRideValue < MONEY(10, 00))
return 0;
if (gParkEntranceFee + MONEY(0, 10) >= RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) / 2)
if (gParkEntranceFee + MONEY(0, 10) >= gTotalRideValue / 2)
return 0;
return 1;
}
@ -216,7 +216,7 @@ static int award_is_deserved_worse_value(int awardType, int activeAwardTypes)
return 0;
if (gParkEntranceFee == MONEY(0, 00))
return 0;
if (RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) >= gParkEntranceFee)
if (gTotalRideValue >= gParkEntranceFee)
return 0;
return 1;
}

View File

@ -884,6 +884,8 @@ 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)
extern const uint8 gRideClassifications[255];
extern money32 _currentTrackPrice;

View File

@ -464,9 +464,9 @@ void scenario_success_submit_name(const char *name)
void scenario_entrance_fee_too_high_check()
{
uint16 x = 0, y = 0;
uint16 totalRideValue = RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16);
uint16 park_entrance_fee = gParkEntranceFee;
int max_fee = totalRideValue + (totalRideValue / 2);
money16 totalRideValue = gTotalRideValue;
money16 park_entrance_fee = gParkEntranceFee;
money16 max_fee = totalRideValue + (totalRideValue / 2);
uint32 game_flags = gParkFlags, packed_xy;
if ((game_flags & PARK_FLAGS_PARK_OPEN) && !(game_flags & PARK_FLAGS_NO_MONEY) && park_entrance_fee > max_fee) {

View File

@ -86,7 +86,7 @@ void park_init()
gGuestChangeModifier = 0;
gParkRating = 0;
_guestGenerationProbability = 0;
RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16) = 0;
gTotalRideValue = 0;
RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, sint32) = -1;
for (i = 0; i < 20; i++)
@ -358,7 +358,8 @@ void reset_park_entrances()
static int park_calculate_guest_generation_probability()
{
unsigned int probability;
int i, suggestedMaxGuests, totalRideValue;
int i, suggestedMaxGuests;
money16 totalRideValue;
rct_ride *ride;
// Calculate suggested guest maximum (based on ride type) and total ride value
@ -377,9 +378,10 @@ static int park_calculate_guest_generation_probability()
// Add ride value
if (ride->value != RIDE_VALUE_UNDEFINED) {
int rideValue = ride->value - ride->price;
if (rideValue > 0)
money16 rideValue = (money16)(ride->value - ride->price);
if (rideValue > 0) {
totalRideValue += rideValue * 2;
}
}
}
@ -409,7 +411,7 @@ static int park_calculate_guest_generation_probability()
}
suggestedMaxGuests = min(suggestedMaxGuests, 65535);
RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16) = totalRideValue;
gTotalRideValue = totalRideValue;
_suggestedGuestMaximum = suggestedMaxGuests;
// Begin with 50 + park rating