diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-07-24 14:59:55 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-07-24 14:59:55 -0400 |
commit | aec18ece75096c372f2c0c00012bba4f06694046 (patch) | |
tree | f204e06fac48f5ab6cf489ee64b096e5b262f5ea /src/ap_state.cpp | |
parent | 639e70d345c6f58f4b6931c8f10b20049ebbd077 (diff) | |
download | lingo-ap-tracker-aec18ece75096c372f2c0c00012bba4f06694046.tar.gz lingo-ap-tracker-aec18ece75096c372f2c0c00012bba4f06694046.tar.bz2 lingo-ap-tracker-aec18ece75096c372f2c0c00012bba4f06694046.zip |
New data storage key format
Diffstat (limited to 'src/ap_state.cpp')
-rw-r--r-- | src/ap_state.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 0f2246b..6c4e42d 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
@@ -45,6 +45,7 @@ struct APState { | |||
45 | bool connected = false; | 45 | bool connected = false; |
46 | bool has_connection_result = false; | 46 | bool has_connection_result = false; |
47 | 47 | ||
48 | std::string data_storage_prefix; | ||
48 | std::list<std::string> tracked_data_storage_keys; | 49 | std::list<std::string> tracked_data_storage_keys; |
49 | 50 | ||
50 | std::map<int64_t, int> inventory; | 51 | std::map<int64_t, int> inventory; |
@@ -201,6 +202,8 @@ struct APState { | |||
201 | tracker_frame->SetStatusMessage("Connected to Archipelago!"); | 202 | tracker_frame->SetStatusMessage("Connected to Archipelago!"); |
202 | TrackerLog("Connected to Archipelago!"); | 203 | TrackerLog("Connected to Archipelago!"); |
203 | 204 | ||
205 | data_storage_prefix = | ||
206 | "Lingo_" + std::to_string(apclient->get_player_number()) + "_"; | ||
204 | door_shuffle_mode = slot_data["shuffle_doors"].get<DoorShuffleMode>(); | 207 | door_shuffle_mode = slot_data["shuffle_doors"].get<DoorShuffleMode>(); |
205 | color_shuffle = slot_data["shuffle_colors"].get<bool>(); | 208 | color_shuffle = slot_data["shuffle_colors"].get<bool>(); |
206 | painting_shuffle = slot_data["shuffle_paintings"].get<bool>(); | 209 | painting_shuffle = slot_data["shuffle_paintings"].get<bool>(); |
@@ -222,8 +225,13 @@ struct APState { | |||
222 | 225 | ||
223 | RefreshTracker(); | 226 | RefreshTracker(); |
224 | 227 | ||
225 | apclient->Get(tracked_data_storage_keys); | 228 | std::list<std::string> corrected_keys; |
226 | apclient->SetNotify(tracked_data_storage_keys); | 229 | for (const std::string& key : tracked_data_storage_keys) { |
230 | corrected_keys.push_back(data_storage_prefix + key); | ||
231 | } | ||
232 | |||
233 | apclient->Get(corrected_keys); | ||
234 | apclient->SetNotify(corrected_keys); | ||
227 | }); | 235 | }); |
228 | 236 | ||
229 | apclient->set_slot_refused_handler( | 237 | apclient->set_slot_refused_handler( |
@@ -363,7 +371,7 @@ struct APState { | |||
363 | } | 371 | } |
364 | 372 | ||
365 | bool HasAchievement(const std::string& name) { | 373 | bool HasAchievement(const std::string& name) { |
366 | std::string key = "Achievement|" + name; | 374 | std::string key = data_storage_prefix + "Achievement|" + name; |
367 | return data_storage.count(key) && data_storage.at(key); | 375 | return data_storage.count(key) && data_storage.at(key); |
368 | } | 376 | } |
369 | 377 | ||