From 8eb8f045b524c8ddd606b726f1de8bd7979a94bd Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Tue, 4 Feb 2025 16:25:17 +0100 Subject: [PATCH] Purge old climate setting from gamestate --- src/openrct2/Editor.cpp | 2 +- src/openrct2/GameState.cpp | 2 +- src/openrct2/GameState.h | 1 - src/openrct2/actions/ClimateSetAction.cpp | 2 +- src/openrct2/rct1/S4Importer.cpp | 3 --- src/openrct2/rct2/S6Importer.cpp | 5 +---- src/openrct2/scripting/bindings/world/ScClimate.hpp | 5 +++-- src/openrct2/world/Climate.cpp | 3 +-- src/openrct2/world/Climate.h | 2 +- 9 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index c98549dcec..961b2d8fc7 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -309,7 +309,7 @@ namespace OpenRCT2::Editor gameState.BankLoanInterestRate = std::clamp(gameState.BankLoanInterestRate, 5, MaxBankLoanInterestRate); } - ClimateReset(gameState.Climate); + ClimateReset(); News::InitQueue(); } diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index 9830ce2d56..765a88510b 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -64,7 +64,7 @@ namespace OpenRCT2 ResetAllEntities(); UpdateConsolidatedPatrolAreas(); ResetDate(); - ClimateReset(ClimateType::CoolAndWet); + ClimateReset(); News::InitQueue(); gInMapInitCode = false; diff --git a/src/openrct2/GameState.h b/src/openrct2/GameState.h index edef39ddad..17e008a2ac 100644 --- a/src/openrct2/GameState.h +++ b/src/openrct2/GameState.h @@ -48,7 +48,6 @@ namespace OpenRCT2 money64 CurrentExpenditure; money64 CurrentProfit; uint32_t GuestsInParkHistory[kGuestsInParkHistorySize]; - ClimateType Climate; WeatherState WeatherCurrent; WeatherState WeatherNext; uint16_t WeatherUpdateTimer; diff --git a/src/openrct2/actions/ClimateSetAction.cpp b/src/openrct2/actions/ClimateSetAction.cpp index 926b7a6448..960c499303 100644 --- a/src/openrct2/actions/ClimateSetAction.cpp +++ b/src/openrct2/actions/ClimateSetAction.cpp @@ -49,7 +49,7 @@ GameActions::Result ClimateSetAction::Query() const GameActions::Result ClimateSetAction::Execute() const { - ClimateReset(_climate); + ClimateReset(); GfxInvalidateScreen(); diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 4e60d2da5a..b2e57fb082 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2359,9 +2359,6 @@ namespace OpenRCT2::RCT1 void ImportClimate(GameState_t& gameState) { - // TODO: remove - gameState.Climate = ClimateType{ _s4.Climate }; - gameState.WeatherUpdateTimer = _s4.WeatherUpdateTimer; gameState.WeatherCurrent = { .weatherType = WeatherType{ _s4.Weather }, diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index f15384299c..791bf245c6 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -552,10 +552,7 @@ namespace OpenRCT2::RCT2 // unk_13CA73E // Pad13CA73F // unk_13CA740 - - // TODO: remove - gameState.Climate = ClimateType{ _s6.Climate }; - + // gameState.Climate = ClimateType{ _s6.Climate }; // Pad13CA741; // Byte13CA742 // Pad013CA747 diff --git a/src/openrct2/scripting/bindings/world/ScClimate.hpp b/src/openrct2/scripting/bindings/world/ScClimate.hpp index 4fcf15f1ec..7fd33773a6 100644 --- a/src/openrct2/scripting/bindings/world/ScClimate.hpp +++ b/src/openrct2/scripting/bindings/world/ScClimate.hpp @@ -53,6 +53,7 @@ namespace OpenRCT2::Scripting class ScClimate { public: + // TODO: replace with climate object static std::string ClimateTypeToString(ClimateType token) { switch (token) @@ -101,8 +102,8 @@ namespace OpenRCT2::Scripting std::string type_get() const { - auto& gameState = GetGameState(); - return ClimateTypeToString(gameState.Climate); + // TODO: from climate object + return ""; } std::shared_ptr current_get() const diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index 5e3ceb4dd3..a6af424c40 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -87,7 +87,7 @@ int32_t ClimateCelsiusToFahrenheit(int32_t celsius) /** * Set climate and determine start weather. */ -void ClimateReset(ClimateType climate) +void ClimateReset() { auto& objManager = GetContext()->GetObjectManager(); auto* climateObj = objManager.GetLoadedObject(0); @@ -101,7 +101,6 @@ void ClimateReset(ClimateType climate) const WeatherTrait& trait = kClimateWeatherTraits[EnumValue(weather)]; auto& gameState = GetGameState(); - gameState.Climate = climate; gameState.WeatherCurrent.weatherType = weather; gameState.WeatherCurrent.temperature = pattern.baseTemperature + trait.temperatureDelta; gameState.WeatherCurrent.weatherEffect = trait.effectLevel; diff --git a/src/openrct2/world/Climate.h b/src/openrct2/world/Climate.h index 0518dc0e0b..36498a9375 100644 --- a/src/openrct2/world/Climate.h +++ b/src/openrct2/world/Climate.h @@ -79,7 +79,7 @@ struct WeatherState extern uint16_t gClimateLightningFlash; int32_t ClimateCelsiusToFahrenheit(int32_t celsius); -void ClimateReset(ClimateType climate); +void ClimateReset(); void ClimateUpdate(); void ClimateUpdateSound(); void ClimateStopWeatherSound();