From 4ffb5871e4bc54ab6765fcd738835c295d1e2924 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 24 Jul 2024 13:36:07 -0400 Subject: Pilgrim Antechamber sunwarp now shows if pilgrimage is doable --- src/tracker_state.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/tracker_state.cpp') 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 { std::mutex reachability_mutex; RequirementCalculator requirements; std::map> door_reports; + bool pilgrimage_doable = false; }; enum Decision { kYes, kNo, kMaybe }; @@ -361,6 +362,8 @@ class StateCalculator { return door_report_; } + bool IsPilgrimageDoable() const { return pilgrimage_doable_; } + std::string GetPathToRoom(int room_id) const { if (!paths_.count(room_id)) { return ""; @@ -572,6 +575,8 @@ class StateCalculator { } } + pilgrimage_doable_ = true; + return kYes; } @@ -612,6 +617,7 @@ class StateCalculator { std::set solveable_panels_; std::set reachable_paintings_; std::map> door_report_; + bool pilgrimage_doable_ = false; std::map> paths_; }; @@ -663,6 +669,7 @@ void RecalculateReachability() { std::swap(GetState().reachable_doors, new_reachable_doors); std::swap(GetState().reachable_paintings, reachable_paintings); std::swap(GetState().door_reports, door_reports); + GetState().pilgrimage_doable = state_calculator.IsPilgrimageDoable(); } bool IsLocationReachable(int location_id) { @@ -692,3 +699,9 @@ const std::map& GetDoorRequirements(int door_id) { return GetState().door_reports[door_id]; } + +bool IsPilgrimageDoable() { + std::lock_guard reachability_guard(GetState().reachability_mutex); + + return GetState().pilgrimage_doable; +} -- cgit 1.4.1