diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 18:27:37 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 18:27:37 -0400 |
| commit | 325ea53e7bb873870b46d3e38b2b314493a22f79 (patch) | |
| tree | 53968efbfd78a5960f68147cd6c671513f04938d /tracker_state.cpp | |
| parent | 08ffb400114029569b4043b4f4c5a3f2af9b37b8 (diff) | |
| download | lingo-ap-tracker-325ea53e7bb873870b46d3e38b2b314493a22f79.tar.gz lingo-ap-tracker-325ea53e7bb873870b46d3e38b2b314493a22f79.tar.bz2 lingo-ap-tracker-325ea53e7bb873870b46d3e38b2b314493a22f79.zip | |
Refactored APState
It is no longer a class, because it didn't need to be.
Diffstat (limited to 'tracker_state.cpp')
| -rw-r--r-- | tracker_state.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
| diff --git a/tracker_state.cpp b/tracker_state.cpp index 4921d3f..6eaf87a 100644 --- a/tracker_state.cpp +++ b/tracker_state.cpp | |||
| @@ -28,9 +28,9 @@ bool IsPanelReachable_Helper(int panel_id, | |||
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | if (GetAPState().IsColorShuffle()) { | 31 | if (AP_IsColorShuffle()) { |
| 32 | for (LingoColor color : panel_obj.colors) { | 32 | for (LingoColor color : panel_obj.colors) { |
| 33 | if (!GetAPState().HasColorItem(color)) { | 33 | if (!AP_HasColorItem(color)) { |
| 34 | return false; | 34 | return false; |
| 35 | } | 35 | } |
| 36 | } | 36 | } |
| @@ -42,7 +42,7 @@ bool IsPanelReachable_Helper(int panel_id, | |||
| 42 | bool IsDoorReachable_Helper(int door_id, const std::set<int>& reachable_rooms) { | 42 | bool IsDoorReachable_Helper(int door_id, const std::set<int>& reachable_rooms) { |
| 43 | const Door& door_obj = GetGameData().GetDoor(door_id); | 43 | const Door& door_obj = GetGameData().GetDoor(door_id); |
| 44 | 44 | ||
| 45 | if (GetAPState().GetDoorShuffleMode() == kNO_DOORS || door_obj.skip_item) { | 45 | if (AP_GetDoorShuffleMode() == kNO_DOORS || door_obj.skip_item) { |
| 46 | if (!reachable_rooms.count(door_obj.room)) { | 46 | if (!reachable_rooms.count(door_obj.room)) { |
| 47 | return false; | 47 | return false; |
| 48 | } | 48 | } |
| @@ -54,15 +54,15 @@ bool IsDoorReachable_Helper(int door_id, const std::set<int>& reachable_rooms) { | |||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | return true; | 56 | return true; |
| 57 | } else if (GetAPState().GetDoorShuffleMode() == kSIMPLE_DOORS && | 57 | } else if (AP_GetDoorShuffleMode() == kSIMPLE_DOORS && |
| 58 | !door_obj.group_name.empty()) { | 58 | !door_obj.group_name.empty()) { |
| 59 | return GetAPState().HasItem(door_obj.group_name); | 59 | return AP_HasItem(door_obj.group_name); |
| 60 | } else { | 60 | } else { |
| 61 | bool has_item = GetAPState().HasItem(door_obj.item_name); | 61 | bool has_item = AP_HasItem(door_obj.item_name); |
| 62 | 62 | ||
| 63 | if (!has_item) { | 63 | if (!has_item) { |
| 64 | for (const ProgressiveRequirement& prog_req : door_obj.progressives) { | 64 | for (const ProgressiveRequirement& prog_req : door_obj.progressives) { |
| 65 | if (GetAPState().HasItem(prog_req.item_name, prog_req.quantity)) { | 65 | if (AP_HasItem(prog_req.item_name, prog_req.quantity)) { |
| 66 | has_item = true; | 66 | has_item = true; |
| 67 | break; | 67 | break; |
| 68 | } | 68 | } |
| @@ -96,7 +96,7 @@ void TrackerState::CalculateState() { | |||
| 96 | if (room_exit.door.has_value()) { | 96 | if (room_exit.door.has_value()) { |
| 97 | if (IsDoorReachable_Helper(*room_exit.door, reachable_rooms)) { | 97 | if (IsDoorReachable_Helper(*room_exit.door, reachable_rooms)) { |
| 98 | valid_transition = true; | 98 | valid_transition = true; |
| 99 | } else if (GetAPState().GetDoorShuffleMode() == kNO_DOORS) { | 99 | } else if (AP_GetDoorShuffleMode() == kNO_DOORS) { |
| 100 | new_boundary.push_back(room_exit); | 100 | new_boundary.push_back(room_exit); |
| 101 | } | 101 | } |
| 102 | } else { | 102 | } else { |
| @@ -110,17 +110,17 @@ void TrackerState::CalculateState() { | |||
| 110 | const Room& room_obj = | 110 | const Room& room_obj = |
| 111 | GetGameData().GetRoom(room_exit.destination_room); | 111 | GetGameData().GetRoom(room_exit.destination_room); |
| 112 | for (const Exit& out_edge : room_obj.exits) { | 112 | for (const Exit& out_edge : room_obj.exits) { |
| 113 | if (!out_edge.painting || !GetAPState().IsPaintingShuffle()) { | 113 | if (!out_edge.painting || !AP_IsPaintingShuffle()) { |
| 114 | new_boundary.push_back(out_edge); | 114 | new_boundary.push_back(out_edge); |
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | if (GetAPState().IsPaintingShuffle()) { | 118 | if (AP_IsPaintingShuffle()) { |
| 119 | for (const PaintingExit& out_edge : room_obj.paintings) { | 119 | for (const PaintingExit& out_edge : room_obj.paintings) { |
| 120 | if (GetAPState().GetPaintingMapping().count(out_edge.id)) { | 120 | if (AP_GetPaintingMapping().count(out_edge.id)) { |
| 121 | Exit painting_exit; | 121 | Exit painting_exit; |
| 122 | painting_exit.destination_room = GetGameData().GetRoomForPainting( | 122 | painting_exit.destination_room = GetGameData().GetRoomForPainting( |
| 123 | GetAPState().GetPaintingMapping().at(out_edge.id)); | 123 | AP_GetPaintingMapping().at(out_edge.id)); |
| 124 | painting_exit.door = out_edge.door; | 124 | painting_exit.door = out_edge.door; |
| 125 | 125 | ||
| 126 | new_boundary.push_back(painting_exit); | 126 | new_boundary.push_back(painting_exit); |
