diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-09 13:02:17 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-09 13:02:17 -0400 |
commit | 7f907a8985b1e2193e210ecc7e18f60c7eea2094 (patch) | |
tree | ba4445b9e35a393e68cf00fab459cd68409d4068 /src | |
parent | 233a0b98a04e6a39cd37cbfc9a6db39a3fcf3e33 (diff) | |
download | lingo-ap-tracker-7f907a8985b1e2193e210ecc7e18f60c7eea2094.tar.gz lingo-ap-tracker-7f907a8985b1e2193e210ecc7e18f60c7eea2094.tar.bz2 lingo-ap-tracker-7f907a8985b1e2193e210ecc7e18f60c7eea2094.zip |
Don't recalc from non-progression items
Diffstat (limited to 'src')
-rw-r--r-- | src/ap_state.cpp | 22 | ||||
-rw-r--r-- | src/tracker_state.cpp | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index fd042b4..1e5621d 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
@@ -39,6 +39,18 @@ constexpr int CONNECTION_BACKOFF_INTERVAL = 100; | |||
39 | 39 | ||
40 | namespace { | 40 | namespace { |
41 | 41 | ||
42 | const std::set<long> kNonProgressionItems = { | ||
43 | 444409, // :) | ||
44 | 444575, // The Feeling of Being Lost | ||
45 | 444576, // Wanderlust | ||
46 | 444577, // Empty White Hallways | ||
47 | 444410, // Slowness Trap | ||
48 | 444411, // Iceland Trap | ||
49 | 444412, // Atbash Trap | ||
50 | 444413, // Puzzle Skip | ||
51 | 444680, // Speed Boost | ||
52 | }; | ||
53 | |||
42 | struct APState { | 54 | struct APState { |
43 | // Initialized on main thread | 55 | // Initialized on main thread |
44 | bool initialized = false; | 56 | bool initialized = false; |
@@ -394,6 +406,7 @@ struct APState { | |||
394 | 406 | ||
395 | void OnItemsReceived(const std::list<APClient::NetworkItem>& items) { | 407 | void OnItemsReceived(const std::list<APClient::NetworkItem>& items) { |
396 | std::vector<ItemState> item_states; | 408 | std::vector<ItemState> item_states; |
409 | bool progression_items = false; | ||
397 | 410 | ||
398 | { | 411 | { |
399 | std::lock_guard state_guard(state_mutex); | 412 | std::lock_guard state_guard(state_mutex); |
@@ -405,6 +418,10 @@ struct APState { | |||
405 | TrackerLog(fmt::format("Item: {}", item.item)); | 418 | TrackerLog(fmt::format("Item: {}", item.item)); |
406 | 419 | ||
407 | index_by_item[item.item] = item.index; | 420 | index_by_item[item.item] = item.index; |
421 | |||
422 | if (!kNonProgressionItems.count(item.item)) { | ||
423 | progression_items = true; | ||
424 | } | ||
408 | } | 425 | } |
409 | 426 | ||
410 | for (const auto& [item_id, item_index] : index_by_item) { | 427 | for (const auto& [item_id, item_index] : index_by_item) { |
@@ -414,7 +431,8 @@ struct APState { | |||
414 | } | 431 | } |
415 | } | 432 | } |
416 | 433 | ||
417 | RefreshTracker(StateUpdate{.items = item_states}); | 434 | RefreshTracker(StateUpdate{.items = item_states, |
435 | .progression_items = progression_items}); | ||
418 | } | 436 | } |
419 | 437 | ||
420 | void OnRetrieved(const std::map<std::string, nlohmann::json>& data) { | 438 | void OnRetrieved(const std::map<std::string, nlohmann::json>& data) { |
@@ -639,7 +657,7 @@ struct APState { | |||
639 | void RefreshTracker(std::optional<StateUpdate> state_update) { | 657 | void RefreshTracker(std::optional<StateUpdate> state_update) { |
640 | TrackerLog("Refreshing display..."); | 658 | TrackerLog("Refreshing display..."); |
641 | 659 | ||
642 | if (!state_update || !state_update->items.empty() || | 660 | if (!state_update || state_update->progression_items || |
643 | !state_update->paintings.empty()) { | 661 | !state_update->paintings.empty()) { |
644 | std::string prev_msg; | 662 | std::string prev_msg; |
645 | { | 663 | { |
diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index 9acf312..40ba6c4 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp | |||
@@ -691,6 +691,8 @@ class StateCalculator { | |||
691 | } // namespace | 691 | } // namespace |
692 | 692 | ||
693 | void ResetReachabilityRequirements() { | 693 | void ResetReachabilityRequirements() { |
694 | TrackerLog("Resetting tracker state..."); | ||
695 | |||
694 | std::lock_guard reachability_guard(GetState().reachability_mutex); | 696 | std::lock_guard reachability_guard(GetState().reachability_mutex); |
695 | GetState().requirements.Reset(); | 697 | GetState().requirements.Reset(); |
696 | GetState().reachable_doors.clear(); | 698 | GetState().reachable_doors.clear(); |
@@ -754,6 +756,8 @@ void ResetReachabilityRequirements() { | |||
754 | } | 756 | } |
755 | 757 | ||
756 | void RecalculateReachability() { | 758 | void RecalculateReachability() { |
759 | TrackerLog("Calculating reachability..."); | ||
760 | |||
757 | std::lock_guard reachability_guard(GetState().reachability_mutex); | 761 | std::lock_guard reachability_guard(GetState().reachability_mutex); |
758 | 762 | ||
759 | // Receiving items and checking paintings should never remove access to doors | 763 | // Receiving items and checking paintings should never remove access to doors |