From d8b955eea2d8b4c86ff09949ae73d37afe39661e Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 7 Feb 2025 15:23:07 +0100 Subject: [PATCH] Rotate weather distribution to be less biased towards sunny weather --- src/openrct2/object/ClimateObject.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/openrct2/object/ClimateObject.cpp b/src/openrct2/object/ClimateObject.cpp index 31c1439687..29ae87b7d3 100644 --- a/src/openrct2/object/ClimateObject.cpp +++ b/src/openrct2/object/ClimateObject.cpp @@ -21,6 +21,7 @@ struct RawClimateMonth int8_t baseTemperature; int8_t randomBias; uint8_t distribution[kNumWeatherTypes]{}; + int8_t distRotation{}; int16_t distributionSum{}; }; @@ -86,6 +87,11 @@ static Climate convertRawClimate(const RawClimate& rawClimate) i++; } } + + // Rotate weather distribution to be less biased towards sunny weather + auto begin = std::begin(dstMonth.distribution); + auto end = std::end(dstMonth.distribution); + std::rotate(begin, begin + srcMonth.distRotation, end); } return climate; @@ -127,6 +133,7 @@ static RawClimate readWeatherTable(json_t& weather) rawClimate[i].baseTemperature = Json::GetNumber(month["baseTemperature"]); rawClimate[i].randomBias = Json::GetNumber(month["randomBias"]); rawClimate[i].distribution[j] = weight; + rawClimate[i].distRotation = Json::GetNumber(month["distRotation"]); rawClimate[i].distributionSum += weight; }