From e7503333e1a71fab0c97315ae0a8ac1388f10d14 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 24 Jul 2024 14:17:40 -0400 Subject: Save analysis uses remote location for non-counting panels --- src/area_popup.cpp | 14 +++++++------- src/game_data.cpp | 4 ++-- src/game_data.h | 4 ++-- src/tracker_panel.cpp | 15 +++++++++------ 4 files changed, 20 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/area_popup.cpp b/src/area_popup.cpp index b18ba62..8d6487e 100644 --- a/src/area_popup.cpp +++ b/src/area_popup.cpp @@ -55,7 +55,7 @@ void AreaPopup::UpdateIndicators() { const Location& location = map_area.locations.at(section_id); if (tracker_panel->IsPanelsMode()) { - if (!location.panel) { + if (!location.single_panel) { continue; } } else { @@ -117,12 +117,12 @@ void AreaPopup::UpdateIndicators() { if (IsLocationWinCondition(location)) { checked = AP_HasReachedGoal(); } else if (tracker_panel->IsPanelsMode()) { - checked = location.panel && std::any_of( - location.panels.begin(), location.panels.end(), - [tracker_panel](int panel_id) { - const Panel& panel = GD_GetPanel(panel_id); - return tracker_panel->GetSolvedPanels().contains(panel.nodepath); - }); + const Panel& panel = GD_GetPanel(*location.single_panel); + if (panel.non_counting) { + checked = AP_HasCheckedGameLocation(location.ap_location_id); + } else { + checked = tracker_panel->GetSolvedPanels().contains(panel.nodepath); + } } else { checked = AP_HasCheckedGameLocation(location.ap_location_id) || diff --git a/src/game_data.cpp b/src/game_data.cpp index b8e1386..c39e239 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp @@ -570,7 +570,7 @@ struct GameData { .panels = {panel.id}, .classification = classification, .hunt = panel.hunt, - .panel = true}); + .single_panel = panel.id}); locations_by_name[location_name] = {area_id, map_area.locations.size() - 1}; } @@ -623,7 +623,7 @@ struct GameData { for (const Location &location : map_area.locations) { map_area.classification |= location.classification; map_area.hunt |= location.hunt; - map_area.panel |= location.panel; + map_area.has_single_panel |= location.single_panel.has_value(); } } diff --git a/src/game_data.h b/src/game_data.h index 71bc533..3179365 100644 --- a/src/game_data.h +++ b/src/game_data.h @@ -114,7 +114,7 @@ struct Location { std::vector panels; int classification = 0; bool hunt = false; - bool panel = false; + std::optional single_panel; }; struct MapArea { @@ -126,7 +126,7 @@ struct MapArea { int map_y; int classification = 0; bool hunt = false; - bool panel = false; + bool has_single_panel = false; }; enum class SubwaySunwarpType { diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index 42c3132..27e825a 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp @@ -180,7 +180,7 @@ void TrackerPanel::Redraw() { for (AreaIndicator &area : areas_) { const MapArea &map_area = GD_GetMapArea(area.area_id); if (panels_mode_) { - area.active = map_area.panel; + area.active = map_area.has_single_panel; } else if (!AP_IsLocationVisible(map_area.classification) && !(map_area.hunt && GetTrackerConfig().show_hunt_panels) && !(AP_IsPaintingShuffle() && !map_area.paintings.empty())) { @@ -200,11 +200,14 @@ void TrackerPanel::Redraw() { if (IsLocationWinCondition(section)) { has_unchecked = !AP_HasReachedGoal(); } else if (panels_mode_) { - has_unchecked = section.panel && std::any_of( - section.panels.begin(), section.panels.end(), [this](int panel_id) { - const Panel &panel = GD_GetPanel(panel_id); - return !solved_panels_.contains(panel.nodepath); - }); + if (section.single_panel) { + const Panel &panel = GD_GetPanel(*section.single_panel); + if (panel.non_counting) { + has_unchecked = !AP_HasCheckedGameLocation(section.ap_location_id); + } else { + has_unchecked = !solved_panels_.contains(panel.nodepath); + } + } } else if (AP_IsLocationVisible(section.classification)) { has_unchecked = !AP_HasCheckedGameLocation(section.ap_location_id); } else if (section.hunt && GetTrackerConfig().show_hunt_panels) { -- cgit 1.4.1