From 5d6314626778cc27bee47a6e93d0f147fe6610e8 Mon Sep 17 00:00:00 2001 From: aMannus Date: Wed, 31 Dec 2025 02:44:01 +0100 Subject: [PATCH] Add setting updater for rando logic setting (#6030) --- soh/soh/OTRGlobals.cpp | 1 + soh/soh/config/ConfigUpdaters.cpp | 9 +++++++++ soh/soh/config/ConfigUpdaters.h | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index e7fe5f31b..60ea90432 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1271,6 +1271,7 @@ extern "C" void InitOTR(int argc, char* argv[]) { conf->RegisterVersionUpdater(std::make_shared()); conf->RegisterVersionUpdater(std::make_shared()); conf->RegisterVersionUpdater(std::make_shared()); + conf->RegisterVersionUpdater(std::make_shared()); conf->RunVersionUpdates(); SohGui::SetupGuiElements(); diff --git a/soh/soh/config/ConfigUpdaters.cpp b/soh/soh/config/ConfigUpdaters.cpp index a7c50a845..d8a7e3f35 100644 --- a/soh/soh/config/ConfigUpdaters.cpp +++ b/soh/soh/config/ConfigUpdaters.cpp @@ -11,6 +11,8 @@ ConfigVersion3Updater::ConfigVersion3Updater() : ConfigVersionUpdater(3) { } ConfigVersion4Updater::ConfigVersion4Updater() : ConfigVersionUpdater(4) { } +ConfigVersion5Updater::ConfigVersion5Updater() : ConfigVersionUpdater(5) { +} void ConfigVersion1Updater::Update(Ship::Config* conf) { if (conf->GetInt("Window.Width", 640) == 640) { @@ -122,4 +124,11 @@ void ConfigVersion4Updater::Update(Ship::Config* conf) { CVarClear(migration.from.c_str()); } } + +void ConfigVersion5Updater::Update(Ship::Config* conf) { + // After removal of Vanilla, make sure it doesn't crash because of an out of range on the combobox + if (CVarGetInteger("gRandoSettings.LogicRules", 0) == 2) { + CVarSetInteger("gRandoSettings.LogicRules", 0); + } +} } // namespace SOH diff --git a/soh/soh/config/ConfigUpdaters.h b/soh/soh/config/ConfigUpdaters.h index 948188c19..4c6af35b3 100644 --- a/soh/soh/config/ConfigUpdaters.h +++ b/soh/soh/config/ConfigUpdaters.h @@ -24,4 +24,10 @@ class ConfigVersion4Updater final : public Ship::ConfigVersionUpdater { ConfigVersion4Updater(); void Update(Ship::Config* conf); }; + +class ConfigVersion5Updater final : public Ship::ConfigVersionUpdater { + public: + ConfigVersion5Updater(); + void Update(Ship::Config* conf); +}; } // namespace SOH