diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-24 13:36:07 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-24 13:36:07 -0400 |
commit | 4ffb5871e4bc54ab6765fcd738835c295d1e2924 (patch) | |
tree | 47d9521046ae6b628ec3b64d5a2890e6a26bcbbf /src/tracker_state.cpp | |
parent | 1a935f45c98905a20a13265ae0d00f9674ec4ea6 (diff) | |
download | lingo-ap-tracker-4ffb5871e4bc54ab6765fcd738835c295d1e2924.tar.gz lingo-ap-tracker-4ffb5871e4bc54ab6765fcd738835c295d1e2924.tar.bz2 lingo-ap-tracker-4ffb5871e4bc54ab6765fcd738835c295d1e2924.zip |
Pilgrim Antechamber sunwarp now shows if pilgrimage is doable
Diffstat (limited to 'src/tracker_state.cpp')
-rw-r--r-- | src/tracker_state.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index bd63076..2ee705c 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp | |||
@@ -152,6 +152,7 @@ struct TrackerState { | |||
152 | std::mutex reachability_mutex; | 152 | std::mutex reachability_mutex; |
153 | RequirementCalculator requirements; | 153 | RequirementCalculator requirements; |
154 | std::map<int, std::map<std::string, bool>> door_reports; | 154 | std::map<int, std::map<std::string, bool>> door_reports; |
155 | bool pilgrimage_doable = false; | ||
155 | }; | 156 | }; |
156 | 157 | ||
157 | enum Decision { kYes, kNo, kMaybe }; | 158 | enum Decision { kYes, kNo, kMaybe }; |
@@ -361,6 +362,8 @@ class StateCalculator { | |||
361 | return door_report_; | 362 | return door_report_; |
362 | } | 363 | } |
363 | 364 | ||
365 | bool IsPilgrimageDoable() const { return pilgrimage_doable_; } | ||
366 | |||
364 | std::string GetPathToRoom(int room_id) const { | 367 | std::string GetPathToRoom(int room_id) const { |
365 | if (!paths_.count(room_id)) { | 368 | if (!paths_.count(room_id)) { |
366 | return ""; | 369 | return ""; |
@@ -572,6 +575,8 @@ class StateCalculator { | |||
572 | } | 575 | } |
573 | } | 576 | } |
574 | 577 | ||
578 | pilgrimage_doable_ = true; | ||
579 | |||
575 | return kYes; | 580 | return kYes; |
576 | } | 581 | } |
577 | 582 | ||
@@ -612,6 +617,7 @@ class StateCalculator { | |||
612 | std::set<int> solveable_panels_; | 617 | std::set<int> solveable_panels_; |
613 | std::set<int> reachable_paintings_; | 618 | std::set<int> reachable_paintings_; |
614 | std::map<int, std::map<std::string, bool>> door_report_; | 619 | std::map<int, std::map<std::string, bool>> door_report_; |
620 | bool pilgrimage_doable_ = false; | ||
615 | 621 | ||
616 | std::map<int, std::list<int>> paths_; | 622 | std::map<int, std::list<int>> paths_; |
617 | }; | 623 | }; |
@@ -663,6 +669,7 @@ void RecalculateReachability() { | |||
663 | std::swap(GetState().reachable_doors, new_reachable_doors); | 669 | std::swap(GetState().reachable_doors, new_reachable_doors); |
664 | std::swap(GetState().reachable_paintings, reachable_paintings); | 670 | std::swap(GetState().reachable_paintings, reachable_paintings); |
665 | std::swap(GetState().door_reports, door_reports); | 671 | std::swap(GetState().door_reports, door_reports); |
672 | GetState().pilgrimage_doable = state_calculator.IsPilgrimageDoable(); | ||
666 | } | 673 | } |
667 | 674 | ||
668 | bool IsLocationReachable(int location_id) { | 675 | bool IsLocationReachable(int location_id) { |
@@ -692,3 +699,9 @@ const std::map<std::string, bool>& GetDoorRequirements(int door_id) { | |||
692 | 699 | ||
693 | return GetState().door_reports[door_id]; | 700 | return GetState().door_reports[door_id]; |
694 | } | 701 | } |
702 | |||
703 | bool IsPilgrimageDoable() { | ||
704 | std::lock_guard reachability_guard(GetState().reachability_mutex); | ||
705 | |||
706 | return GetState().pilgrimage_doable; | ||
707 | } | ||