about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/ap_state.cpp24
-rw-r--r--src/ap_state.h5
-rw-r--r--src/subway_map.cpp24
-rw-r--r--src/subway_map.h2
4 files changed, 41 insertions, 14 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index e5ff74d..68a6902 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp
@@ -103,6 +103,7 @@ struct APState {
103 } 103 }
104 104
105 tracked_data_storage_keys.push_back("PlayerPos"); 105 tracked_data_storage_keys.push_back("PlayerPos");
106 tracked_data_storage_keys.push_back("Paintings");
106 107
107 initialized = true; 108 initialized = true;
108 } 109 }
@@ -384,6 +385,14 @@ struct APState {
384 } 385 }
385 386
386 wxLogMessage("Data storage %s retrieved as null", key); 387 wxLogMessage("Data storage %s retrieved as null", key);
388 } else if (value.is_array()) {
389 if (key.ends_with("Paintings")) {
390 data_storage[key] = value.get<std::set<std::string>>();
391 } else {
392 data_storage[key] = value.get<std::vector<std::string>>();
393 }
394
395 wxLogMessage("Data storage %s retrieved as list", key);
387 } 396 }
388 } 397 }
389 398
@@ -406,6 +415,15 @@ struct APState {
406 return data_storage.count(key) && std::any_cast<bool>(data_storage.at(key)); 415 return data_storage.count(key) && std::any_cast<bool>(data_storage.at(key));
407 } 416 }
408 417
418 const std::set<std::string>& GetCheckedPaintings() {
419 std::string key = data_storage_prefix + "Paintings";
420 if (!data_storage.count(key)) {
421 data_storage[key] = std::set<std::string>();
422 }
423
424 return std::any_cast<const std::set<std::string>&>(data_storage.at(key));
425 }
426
409 void RefreshTracker(bool reset) { 427 void RefreshTracker(bool reset) {
410 wxLogMessage("Refreshing display..."); 428 wxLogMessage("Refreshing display...");
411 429
@@ -471,10 +489,14 @@ bool AP_IsColorShuffle() { return GetState().color_shuffle; }
471 489
472bool AP_IsPaintingShuffle() { return GetState().painting_shuffle; } 490bool AP_IsPaintingShuffle() { return GetState().painting_shuffle; }
473 491
474const std::map<std::string, std::string> AP_GetPaintingMapping() { 492const std::map<std::string, std::string>& AP_GetPaintingMapping() {
475 return GetState().painting_mapping; 493 return GetState().painting_mapping;
476} 494}
477 495
496const std::set<std::string>& AP_GetCheckedPaintings() {
497 return GetState().GetCheckedPaintings();
498}
499
478int AP_GetMasteryRequirement() { return GetState().mastery_requirement; } 500int AP_GetMasteryRequirement() { return GetState().mastery_requirement; }
479 501
480int AP_GetLevel2Requirement() { return GetState().level_2_requirement; } 502int AP_GetLevel2Requirement() { return GetState().level_2_requirement; }
diff --git a/src/ap_state.h b/src/ap_state.h index 6667e0d..5fbb720 100644 --- a/src/ap_state.h +++ b/src/ap_state.h
@@ -3,6 +3,7 @@
3 3
4#include <map> 4#include <map>
5#include <optional> 5#include <optional>
6#include <set>
6#include <string> 7#include <string>
7#include <tuple> 8#include <tuple>
8 9
@@ -54,7 +55,9 @@ bool AP_IsColorShuffle();
54 55
55bool AP_IsPaintingShuffle(); 56bool AP_IsPaintingShuffle();
56 57
57const std::map<std::string, std::string> AP_GetPaintingMapping(); 58const std::map<std::string, std::string>& AP_GetPaintingMapping();
59
60const std::set<std::string>& AP_GetCheckedPaintings();
58 61
59int AP_GetMasteryRequirement(); 62int AP_GetMasteryRequirement();
60 63
diff --git a/src/subway_map.cpp b/src/subway_map.cpp index 99638aa..460532c 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp
@@ -82,17 +82,21 @@ void SubwayMap::OnConnect() {
82} 82}
83 83
84void SubwayMap::UpdateIndicators() { 84void SubwayMap::UpdateIndicators() {
85 Redraw(); 85 if (AP_IsPaintingShuffle()) {
86} 86 for (const std::string &painting_id : AP_GetCheckedPaintings()) {
87 87 if (!checked_paintings_.count(painting_id)) {
88void SubwayMap::UpdatePainting(std::string from_painting_id, 88 checked_paintings_.insert(painting_id);
89 std::optional<std::string> to_painting_id) { 89
90 checked_paintings_.insert(from_painting_id); 90 if (AP_GetPaintingMapping().count(painting_id)) {
91 91 networks_.AddLink(GD_GetSubwayItemForPainting(painting_id),
92 if (to_painting_id) { 92 GD_GetSubwayItemForPainting(
93 networks_.AddLink(GD_GetSubwayItemForPainting(from_painting_id), 93 AP_GetPaintingMapping().at(painting_id)));
94 GD_GetSubwayItemForPainting(*to_painting_id)); 94 }
95 }
96 }
95 } 97 }
98
99 Redraw();
96} 100}
97 101
98void SubwayMap::UpdateSunwarp(SubwaySunwarp from_sunwarp, 102void SubwayMap::UpdateSunwarp(SubwaySunwarp from_sunwarp,
diff --git a/src/subway_map.h b/src/subway_map.h index 1637125..e5f0bf6 100644 --- a/src/subway_map.h +++ b/src/subway_map.h
@@ -24,8 +24,6 @@ class SubwayMap : public wxPanel {
24 24
25 void OnConnect(); 25 void OnConnect();
26 void UpdateIndicators(); 26 void UpdateIndicators();
27 void UpdatePainting(std::string from_painting_id,
28 std::optional<std::string> to_painting_id);
29 void UpdateSunwarp(SubwaySunwarp from_sunwarp, SubwaySunwarp to_sunwarp); 27 void UpdateSunwarp(SubwaySunwarp from_sunwarp, SubwaySunwarp to_sunwarp);
30 28
31 private: 29 private: