From dcc5e5bd813cc8a420049bb678cfb0d1e5f886d8 Mon Sep 17 00:00:00 2001 From: AaronVanGeffen Date: Mon, 3 Feb 2025 20:41:36 +0100 Subject: [PATCH] Fix weather transitions --- distribution/changelog.txt | 1 + src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/world/Climate.cpp | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 20a66214cf..4d7007305f 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.20 (in development) ------------------------------------------------------------------------ +- Fix: [#23771] Weather transitions are horribly broken. 0.4.19 (2025-02-01) ------------------------------------------------------------------------ diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index ee02351757..0b2f685278 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -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); diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index e997a2d137..b23748f401 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -80,7 +80,7 @@ static int32_t _thunderStereoEcho = 0; static std::shared_ptr _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;