Let heavy snow and blizzards make guests buy and use umbrellas

This commit is contained in:
Aaron van Geffen 2024-05-07 23:14:58 +02:00
parent 11510a0e0b
commit 400c48e74f
4 changed files with 21 additions and 18 deletions

View File

@ -2,6 +2,7 @@
------------------------------------------------------------------------
- Feature: [#21714] [Plugin] Costume assignment is now tailored to each staff type.
- Feature: [#21913] [Plugin] Allow precise and safe control of peep animations.
- Change: [#20240] Heavy snow and blizzards now make guests buy and use umbrellas.
0.4.11 (2024-05-05)
------------------------------------------------------------------------

View File

@ -1479,7 +1479,9 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price)
bool hasVoucher = false;
bool isRainingAndUmbrella = shopItem == ShopItem::Umbrella && ClimateIsRaining();
const bool isPrecipitation = ClimateIsRaining() || ClimateIsSnowingHeavily();
const bool isUmbrella = shopItem == ShopItem::Umbrella;
const bool isRainingAndUmbrella = isPrecipitation && isUmbrella;
if ((HasItem(ShopItem::Voucher)) && (VoucherType == VOUCHER_TYPE_FOOD_OR_DRINK_FREE) && (VoucherShopItem == shopItem))
{
@ -1508,7 +1510,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price)
if ((shopItem == ShopItem::Balloon || shopItem == ShopItem::IceCream || shopItem == ShopItem::Candyfloss
|| shopItem == ShopItem::Sunglasses)
&& ClimateIsRaining())
&& isPrecipitation)
{
return false;
}
@ -2056,7 +2058,8 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b
}
else
{
if (ClimateIsRaining() && !ShouldRideWhileRaining(ride))
const bool isPrecipitation = ClimateIsRaining() || ClimateIsSnowingHeavily();
if (isPrecipitation && !ShouldRideWhileRaining(ride))
{
if (peepAtRide)
{
@ -2072,7 +2075,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b
}
// If it is raining and the ride provides shelter skip the
// ride intensity check and get me on a sheltered ride!
if (!ClimateIsRaining() || !ShouldRideWhileRaining(ride))
if (!isPrecipitation || !ShouldRideWhileRaining(ride))
{
if (!GetGameState().Cheats.IgnoreRideIntensity)
{
@ -6821,7 +6824,8 @@ void Guest::UpdateSpriteType()
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
}
if (ClimateIsRaining() && (HasItem(ShopItem::Umbrella)) && x != LOCATION_NULL)
const bool isPrecipitation = ClimateIsRaining() || ClimateIsSnowingHeavily();
if (isPrecipitation && (HasItem(ShopItem::Umbrella)) && x != LOCATION_NULL)
{
CoordsXY loc = { x, y };
if (MapIsLocationValid(loc.ToTileStart()))

View File

@ -234,25 +234,22 @@ void ClimateUpdateSound()
bool ClimateIsRaining()
{
auto& gameState = GetGameState();
if (gameState.ClimateCurrent.Weather == WeatherType::Rain || gameState.ClimateCurrent.Weather == WeatherType::HeavyRain
|| gameState.ClimateCurrent.Weather == WeatherType::Thunder)
{
return true;
}
return false;
return gameState.ClimateCurrent.Weather == WeatherType::Rain || gameState.ClimateCurrent.Weather == WeatherType::HeavyRain
|| gameState.ClimateCurrent.Weather == WeatherType::Thunder;
}
bool ClimateIsSnowing()
{
auto& gameState = GetGameState();
if (gameState.ClimateCurrent.Weather == WeatherType::Snow || gameState.ClimateCurrent.Weather == WeatherType::HeavySnow
|| gameState.ClimateCurrent.Weather == WeatherType::Blizzard)
{
return true;
}
return gameState.ClimateCurrent.Weather == WeatherType::Snow || gameState.ClimateCurrent.Weather == WeatherType::HeavySnow
|| gameState.ClimateCurrent.Weather == WeatherType::Blizzard;
}
return false;
bool ClimateIsSnowingHeavily()
{
auto& gameState = GetGameState();
return gameState.ClimateCurrent.Weather == WeatherType::HeavySnow
|| gameState.ClimateCurrent.Weather == WeatherType::Blizzard;
}
bool WeatherIsDry(WeatherType weatherType)

View File

@ -81,6 +81,7 @@ void ClimateForceWeather(WeatherType weather);
bool ClimateIsRaining();
bool ClimateIsSnowing();
bool ClimateIsSnowingHeavily();
bool WeatherIsDry(WeatherType);
FilterPaletteID ClimateGetWeatherGloomPaletteId(const ClimateState& state);
uint32_t ClimateGetWeatherSpriteId(const ClimateState& state);