diff options
Diffstat (limited to 'src/tracker_state.cpp')
-rw-r--r-- | src/tracker_state.cpp | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index ba615d1..14d302b 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp | |||
@@ -19,11 +19,12 @@ namespace { | |||
19 | struct Requirements { | 19 | struct Requirements { |
20 | bool disabled = false; | 20 | bool disabled = false; |
21 | 21 | ||
22 | std::set<int> doors; // non-grouped, handles progressive | 22 | std::set<int> doors; // non-grouped, handles progressive |
23 | std::set<int> items; // all other items | 23 | std::set<int> panel_doors; // non-grouped, handles progressive |
24 | std::set<int> rooms; // maybe | 24 | std::set<int> items; // all other items |
25 | bool mastery = false; // maybe | 25 | std::set<int> rooms; // maybe |
26 | bool panel_hunt = false; // maybe | 26 | bool mastery = false; // maybe |
27 | bool panel_hunt = false; // maybe | ||
27 | 28 | ||
28 | void Merge(const Requirements& rhs) { | 29 | void Merge(const Requirements& rhs) { |
29 | if (rhs.disabled) { | 30 | if (rhs.disabled) { |
@@ -33,6 +34,9 @@ struct Requirements { | |||
33 | for (int id : rhs.doors) { | 34 | for (int id : rhs.doors) { |
34 | doors.insert(id); | 35 | doors.insert(id); |
35 | } | 36 | } |
37 | for (int id : rhs.panel_doors) { | ||
38 | panel_doors.insert(id); | ||
39 | } | ||
36 | for (int id : rhs.items) { | 40 | for (int id : rhs.items) { |
37 | items.insert(id); | 41 | items.insert(id); |
38 | } | 42 | } |
@@ -78,15 +82,14 @@ class RequirementCalculator { | |||
78 | requirements.doors.insert(door_obj.id); | 82 | requirements.doors.insert(door_obj.id); |
79 | break; | 83 | break; |
80 | } | 84 | } |
81 | } else if (AP_GetDoorShuffleMode() == kNO_DOORS || door_obj.skip_item) { | 85 | } else if (AP_GetDoorShuffleMode() != kDOORS_MODE || door_obj.skip_item) { |
82 | requirements.rooms.insert(door_obj.room); | 86 | requirements.rooms.insert(door_obj.room); |
83 | 87 | ||
84 | for (int panel_id : door_obj.panels) { | 88 | for (int panel_id : door_obj.panels) { |
85 | const Requirements& panel_reqs = GetPanel(panel_id); | 89 | const Requirements& panel_reqs = GetPanel(panel_id); |
86 | requirements.Merge(panel_reqs); | 90 | requirements.Merge(panel_reqs); |
87 | } | 91 | } |
88 | } else if (AP_GetDoorShuffleMode() == kSIMPLE_DOORS && | 92 | } else if (AP_AreDoorsGrouped() && !door_obj.group_name.empty()) { |
89 | !door_obj.group_name.empty()) { | ||
90 | requirements.items.insert(door_obj.group_ap_item_id); | 93 | requirements.items.insert(door_obj.group_ap_item_id); |
91 | } else { | 94 | } else { |
92 | requirements.doors.insert(door_obj.id); | 95 | requirements.doors.insert(door_obj.id); |
@@ -133,6 +136,17 @@ class RequirementCalculator { | |||
133 | requirements.items.insert(GD_GetItemIdForColor(color)); | 136 | requirements.items.insert(GD_GetItemIdForColor(color)); |
134 | } | 137 | } |
135 | } | 138 | } |
139 | |||
140 | if (panel_obj.panel_door != -1 && | ||
141 | AP_GetDoorShuffleMode() == kPANELS_MODE) { | ||
142 | const PanelDoor& panel_door_obj = GD_GetPanelDoor(panel_obj.panel_door); | ||
143 | |||
144 | if (panel_door_obj.group_ap_item_id != -1 && AP_AreDoorsGrouped()) { | ||
145 | requirements.items.insert(panel_door_obj.group_ap_item_id); | ||
146 | } else { | ||
147 | requirements.panel_doors.insert(panel_obj.panel_door); | ||
148 | } | ||
149 | } | ||
136 | 150 | ||
137 | panels_[panel_id] = requirements; | 151 | panels_[panel_id] = requirements; |
138 | } | 152 | } |
@@ -375,7 +389,8 @@ class StateCalculator { | |||
375 | } | 389 | } |
376 | 390 | ||
377 | private: | 391 | private: |
378 | Decision IsNonGroupedDoorReachable(const Door& door_obj) { | 392 | template <typename T> |
393 | Decision IsNonGroupedDoorReachable(const T& door_obj) { | ||
379 | bool has_item = AP_HasItem(door_obj.ap_item_id); | 394 | bool has_item = AP_HasItem(door_obj.ap_item_id); |
380 | 395 | ||
381 | if (!has_item) { | 396 | if (!has_item) { |
@@ -411,6 +426,20 @@ class StateCalculator { | |||
411 | } | 426 | } |
412 | } | 427 | } |
413 | 428 | ||
429 | for (int panel_door_id : reqs.panel_doors) { | ||
430 | const PanelDoor& panel_door_obj = GD_GetPanelDoor(panel_door_id); | ||
431 | Decision decision = IsNonGroupedDoorReachable(panel_door_obj); | ||
432 | |||
433 | if (report) { | ||
434 | (*report)[AP_GetItemName(panel_door_obj.ap_item_id)] = | ||
435 | (decision == kYes); | ||
436 | } | ||
437 | |||
438 | if (decision != kYes) { | ||
439 | final_decision = decision; | ||
440 | } | ||
441 | } | ||
442 | |||
414 | for (int item_id : reqs.items) { | 443 | for (int item_id : reqs.items) { |
415 | bool has_item = AP_HasItem(item_id); | 444 | bool has_item = AP_HasItem(item_id); |
416 | if (report) { | 445 | if (report) { |