Add new helper to check if raining

This commit is contained in:
Ted John authored and Richard Jenkins committed 2018-01-14 01:06:47 +00:00
1 parent 742690b4f4
commit 9afbfe02ab
4 files changed
+12 -6

No files matched your search

+5 -5
View File
@@ -1899,7 +1899,7 @@ void peep_update_sprite_type(rct_peep * peep)
peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY;
}
if (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE && (peep->item_standard_flags & PEEP_ITEM_UMBRELLA) && peep->x != LOCATION_NULL)
if (climate_is_raining() && (peep->item_standard_flags & PEEP_ITEM_UMBRELLA) && peep->x != LOCATION_NULL)
{
sint32 x = peep->x & 0xFFE0;
sint32 y = peep->y & 0xFFE0;
@@ -12152,7 +12152,7 @@ static bool peep_decide_and_buy_item(rct_peep * peep, sint32 rideIndex, sint32 s
if ((shopItem == SHOP_ITEM_BALLOON) || (shopItem == SHOP_ITEM_ICE_CREAM) || (shopItem == SHOP_ITEM_CANDYFLOSS) ||
(shopItem == SHOP_ITEM_SUNGLASSES))
{
if (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE)
if (climate_is_raining())
return false;
}
@@ -12174,7 +12174,7 @@ static bool peep_decide_and_buy_item(rct_peep * peep, sint32 rideIndex, sint32 s
return false;
}
if ((shopItem == SHOP_ITEM_UMBRELLA) && (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE))
if (shopItem == SHOP_ITEM_UMBRELLA && climate_is_raining())
goto loc_69B119;
if ((shopItem != SHOP_ITEM_MAP) && shop_item_is_souvenir(shopItem) && !has_voucher)
@@ -12214,7 +12214,7 @@ loc_69B119:
value -= price;
if (shopItem == SHOP_ITEM_UMBRELLA)
{
if (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE)
if (climate_is_raining())
goto loc_69B221;
}
@@ -13199,7 +13199,7 @@ static bool peep_should_go_on_ride(rct_peep * peep, sint32 rideIndex, sint32 ent
// Peeps won't go on rides that aren't sufficiently undercover while it's raining.
// The threshold is fairly low and only requires about 10-15% of the ride to be undercover.
if (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE && (ride->sheltered_eighths >> 5) < 3)
if (climate_is_raining() && (ride->sheltered_eighths >> 5) < 3)
{
if (peepAtRide)
{
+1 -1
View File
@@ -2353,7 +2353,7 @@ static sint32 ride_get_new_breakdown_problem(Ride *ride)
rct_ride_entry *entry;
// Brake failure is more likely when it's raining
_breakdownProblemProbabilities[BREAKDOWN_BRAKES_FAILURE] = gClimateCurrent.RainLevel == RAIN_LEVEL_NONE ? 3 : 20;
_breakdownProblemProbabilities[BREAKDOWN_BRAKES_FAILURE] = climate_is_raining() ? 20 : 3;
entry = get_ride_entry_by_ride(ride);
if (entry == nullptr || entry->flags & RIDE_ENTRY_FLAG_CANNOT_BREAK_DOWN)
+5
View File
@@ -221,6 +221,11 @@ extern "C"
}
}
bool climate_is_raining()
{
return gClimateCurrent.RainLevel != RAIN_LEVEL_NONE;
}
uint32 climate_get_weather_sprite_id(const ClimateState &state)
{
uint32 spriteId = SPR_WEATHER_SUN;
+1
View File
@@ -91,6 +91,7 @@ extern "C"
#ifdef __cplusplus
}
bool climate_is_raining();
uint32 climate_get_weather_sprite_id(const ClimateState &state);
#endif