diff options
| author | Malkierian <malkierian@gmail.com> | 2024-12-15 15:20:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-15 15:20:51 -0700 |
| commit | add5347126aa7e7cbd10cc138b74491725e65700 (patch) | |
| tree | 151c5fc834b28fbb383cfbed55f5da9f8c9eef9b | |
| parent | 0f167d119b54773c3b87f994ea25e71d0a50e92e (diff) | |
Properly check for pre-existing gInjectItemCounts before setting the new separate CVars. (#4692)
| -rw-r--r-- | soh/soh/config/ConfigUpdaters.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/soh/soh/config/ConfigUpdaters.cpp b/soh/soh/config/ConfigUpdaters.cpp index e43e98b76..6c18b6fd4 100644 --- a/soh/soh/config/ConfigUpdaters.cpp +++ b/soh/soh/config/ConfigUpdaters.cpp @@ -71,17 +71,17 @@ namespace SOH { void ConfigVersion3Updater::Update(Ship::Config* conf) { conf->EraseBlock("Controllers"); + if (conf->GetNestedJson().contains("CVars") && conf->GetNestedJson()["CVars"].contains("gInjectItemCounts")) { + CVarClear("gInjectItemCounts"); + CVarSetInteger("gEnhancements.InjectItemCounts.GoldSkulltula", 1); + CVarSetInteger("gEnhancements.InjectItemCounts.HeartContainer", 1); + CVarSetInteger("gEnhancements.InjectItemCounts.HeartPiece", 1); + } for (Migration migration : version3Migrations) { if (migration.action == MigrationAction::Rename) { CVarCopy(migration.from.c_str(), migration.to.value().c_str()); } CVarClear(migration.from.c_str()); } - if (conf->Contains("CVars.gEnhancements.InjectItemCounts")) { - CVarClear("gEnhancements.InjectItemCounts"); - CVarSetInteger("gEnhancements.InjectItemCounts.GoldSkulltula", 1); - CVarSetInteger("gEnhancements.InjectItemCounts.HeartContainer", 1); - CVarSetInteger("gEnhancements.InjectItemCounts.HeartPiece", 1); - } } } |
