use enum for logic (#2098)

Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
briaguya 2022-12-06 00:37:07 -05:00 committed by GitHub
parent 4ee0ddaa15
commit d03e876289
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -2507,10 +2507,10 @@ namespace Settings {
// RANDTODO: Switch this back once all logic options are implemented
// Logic.SetSelectedIndex(cvarSettings[RSK_LOGIC_RULES]);
switch (cvarSettings[RSK_LOGIC_RULES]) {
case 0:
case RO_LOGIC_GLITCHLESS:
Logic.SetSelectedIndex(0);
break;
case 1:
case RO_LOGIC_NO_LOGIC:
Logic.SetSelectedIndex(2);
break;
}

View File

@ -2560,7 +2560,7 @@ void GenerateRandomizerImgui() {
CVar_Save();
std::unordered_map<RandomizerSettingKey, u8> cvarSettings;
cvarSettings[RSK_LOGIC_RULES] = CVar_GetS32("gRandomizeLogicRules", 0);
cvarSettings[RSK_LOGIC_RULES] = CVar_GetS32("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS);
cvarSettings[RSK_FOREST] = CVar_GetS32("gRandomizeForest", RO_FOREST_CLOSED);
cvarSettings[RSK_KAK_GATE] = CVar_GetS32("gRandomizeKakarikoGate", RO_KAK_GATE_CLOSED);
cvarSettings[RSK_DOOR_OF_TIME] = CVar_GetS32("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED);
@ -2890,7 +2890,7 @@ void DrawRandoEditor(bool& open) {
//Starting Age
//Disabled when Forest is set to Closed or under very specific conditions
//RANDOTODO: Replace magic number checks with enums
bool disableRandoStartingAge = (CVar_GetS32("gRandomizeLogicRules", 0) == 0) && // glitchless logic
bool disableRandoStartingAge = (CVar_GetS32("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) &&
((CVar_GetS32("gRandomizeForest", RO_FOREST_CLOSED) == RO_FOREST_CLOSED) ||
((CVar_GetS32("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED) &&
(CVar_GetS32("gRandomizeShuffleOcarinas", 0) == 0))); // ocarinas not shuffled