From e88c8e68b62ab0dd488cc8b9901059529f052a60 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Sat, 4 Nov 2023 14:53:29 -0700 Subject: [PATCH] [Bugfix] Fixes check tracker crash on max debug file creation (#3309) * Change initialization of `areasSpoiled` to improve utilization and fix crash during max debug file creation. * Renamed `RCAreaFromSceneID` to `DungeonRCAreasBySceneID` for clarification. --- .../randomizer/randomizer_check_tracker.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 1489b25d2..5f7790dd0 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -96,7 +96,7 @@ std::map startingShopItem = { { SCENE_KOKIRI_SHOP, RC { SCENE_ZORA_SHOP, RC_ZD_SHOP_ITEM_1 }, { SCENE_GORON_SHOP, RC_GC_SHOP_ITEM_1 } }; -std::map RCAreaFromSceneID = { +std::map DungeonRCAreasBySceneID = { {SCENE_DEKU_TREE, RCAREA_DEKU_TREE}, {SCENE_DODONGOS_CAVERN, RCAREA_DODONGOS_CAVERN}, {SCENE_JABU_JABU, RCAREA_JABU_JABUS_BELLY}, @@ -1157,9 +1157,11 @@ bool IsVisibleInCheckTracker(RandomizerCheckObject rcObj) { void UpdateInventoryChecks() { //For all the areas with compasses, if you have one, spoil the area - for (u8 i = SCENE_DEKU_TREE; i <= SCENE_GERUDO_TRAINING_GROUND; i++) - if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, i)) - areasSpoiled |= (1 << RCAreaFromSceneID.at((SceneID)i)); + for (auto [scene, area] : DungeonRCAreasBySceneID) { + if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, scene)) { + areasSpoiled |= (1 << area); + } + } } void UpdateAreaFullyChecked(RandomizerCheckArea area) {