1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Fix weather transitions

This commit is contained in:
AaronVanGeffen
2025-02-03 20:41:36 +01:00
committed by Gymnasiast
parent dcc926c4f0
commit dcc5e5bd81
3 changed files with 5 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
0.4.20 (in development)
------------------------------------------------------------------------
- Fix: [#23771] Weather transitions are horribly broken.
0.4.19 (2025-02-01)
------------------------------------------------------------------------

View File

@@ -49,7 +49,7 @@ using namespace OpenRCT2;
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
constexpr uint8_t kNetworkStreamVersion = 0;
constexpr uint8_t kNetworkStreamVersion = 1;
const std::string kNetworkStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kNetworkStreamVersion);

View File

@@ -80,7 +80,7 @@ static int32_t _thunderStereoEcho = 0;
static std::shared_ptr<IAudioChannel> _weatherSoundChannel;
static int8_t ClimateStepWeatherLevel(int8_t currentWeatherLevel, int8_t nextWeatherLevel);
static void ClimateDetermineFutureWeather(int32_t randomValue);
static void ClimateDetermineFutureWeather(uint32_t randomValue);
static void ClimateUpdateWeatherSound();
static void ClimateUpdateThunderSound();
static void ClimateUpdateLightning();
@@ -303,7 +303,7 @@ static int8_t ClimateStepWeatherLevel(int8_t currentWeatherLevel, int8_t nextWea
* for nextWeather. The other weather parameters are then looked up depending only on the
* next weather.
*/
static void ClimateDetermineFutureWeather(int32_t randomValue)
static void ClimateDetermineFutureWeather(uint32_t randomValue)
{
int32_t month = GetDate().GetMonth();
auto& gameState = GetGameState();
@@ -311,7 +311,7 @@ static void ClimateDetermineFutureWeather(int32_t randomValue)
// Generate a random index with values 0 up to randomBias-1
// and choose weather from the distribution table accordingly
const auto& pattern = kClimatePatterns[EnumValue(gameState.Climate)][month];
auto randomIndex = ((randomValue % 256) * pattern.randomBias) / 256;
size_t randomIndex = ((randomValue % 256) * pattern.randomBias) / 256;
auto nextWeather = pattern.distribution[randomIndex];
gameState.ClimateNext.Weather = nextWeather;