diff options
Diffstat (limited to 'src/tracker_state.cpp')
-rw-r--r-- | src/tracker_state.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index e462b29..cc19b19 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp | |||
@@ -12,7 +12,7 @@ | |||
12 | namespace { | 12 | namespace { |
13 | 13 | ||
14 | struct TrackerState { | 14 | struct TrackerState { |
15 | std::map<std::tuple<int, int>, bool> reachability; | 15 | std::map<int, bool> reachability; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | enum Decision { kYes, kNo, kMaybe }; | 18 | enum Decision { kYes, kNo, kMaybe }; |
@@ -41,13 +41,13 @@ Decision IsDoorReachable_Helper(int door_id, | |||
41 | return kYes; | 41 | return kYes; |
42 | } else if (AP_GetDoorShuffleMode() == kSIMPLE_DOORS && | 42 | } else if (AP_GetDoorShuffleMode() == kSIMPLE_DOORS && |
43 | !door_obj.group_name.empty()) { | 43 | !door_obj.group_name.empty()) { |
44 | return AP_HasItem(door_obj.group_name) ? kYes : kNo; | 44 | return AP_HasItem(door_obj.group_ap_item_id) ? kYes : kNo; |
45 | } else { | 45 | } else { |
46 | bool has_item = AP_HasItem(door_obj.item_name); | 46 | bool has_item = AP_HasItem(door_obj.ap_item_id); |
47 | 47 | ||
48 | if (!has_item) { | 48 | if (!has_item) { |
49 | for (const ProgressiveRequirement& prog_req : door_obj.progressives) { | 49 | for (const ProgressiveRequirement& prog_req : door_obj.progressives) { |
50 | if (AP_HasItem(prog_req.item_name, prog_req.quantity)) { | 50 | if (AP_HasItem(prog_req.ap_item_id, prog_req.quantity)) { |
51 | has_item = true; | 51 | has_item = true; |
52 | break; | 52 | break; |
53 | } | 53 | } |
@@ -127,7 +127,7 @@ Decision IsPanelReachable_Helper(int panel_id, | |||
127 | 127 | ||
128 | if (AP_IsColorShuffle()) { | 128 | if (AP_IsColorShuffle()) { |
129 | for (LingoColor color : panel_obj.colors) { | 129 | for (LingoColor color : panel_obj.colors) { |
130 | if (!AP_HasColorItem(color)) { | 130 | if (!AP_HasItem(GD_GetItemIdForColor(color))) { |
131 | return kNo; | 131 | return kNo; |
132 | } | 132 | } |
133 | } | 133 | } |
@@ -232,16 +232,14 @@ void RecalculateReachability() { | |||
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | GetState().reachability[{map_area.id, section_id}] = reachable; | 235 | GetState().reachability[location_section.ap_location_id] = reachable; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | bool IsLocationReachable(int area_id, int section_id) { | 240 | bool IsLocationReachable(int location_id) { |
241 | std::tuple<int, int> key = {area_id, section_id}; | 241 | if (GetState().reachability.count(location_id)) { |
242 | 242 | return GetState().reachability.at(location_id); | |
243 | if (GetState().reachability.count(key)) { | ||
244 | return GetState().reachability.at(key); | ||
245 | } else { | 243 | } else { |
246 | return false; | 244 | return false; |
247 | } | 245 | } |