diff options
| author | aMannus <mannusmenting@gmail.com> | 2025-12-31 02:44:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-31 01:44:01 +0000 |
| commit | 5d6314626778cc27bee47a6e93d0f147fe6610e8 (patch) | |
| tree | 62f0956e970355cacc57288f2d4f9875dbb6856d | |
| parent | 50c023b86b7ddcf3d9281263235d6d44a6fe4af3 (diff) | |
Add setting updater for rando logic setting (#6030)
| -rw-r--r-- | soh/soh/OTRGlobals.cpp | 1 | ||||
| -rw-r--r-- | soh/soh/config/ConfigUpdaters.cpp | 9 | ||||
| -rw-r--r-- | soh/soh/config/ConfigUpdaters.h | 6 |
3 files changed, 16 insertions, 0 deletions
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<SOH::ConfigVersion2Updater>()); conf->RegisterVersionUpdater(std::make_shared<SOH::ConfigVersion3Updater>()); conf->RegisterVersionUpdater(std::make_shared<SOH::ConfigVersion4Updater>()); + conf->RegisterVersionUpdater(std::make_shared<SOH::ConfigVersion5Updater>()); 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 |
