Properly check for pre-existing gInjectItemCounts before setting the new separate CVars. (#4692)

This commit is contained in:
Malkierian 2024-12-15 15:20:51 -07:00 committed by GitHub
parent 0f167d119b
commit add5347126
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}
}
}