From aec18ece75096c372f2c0c00012bba4f06694046 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 24 Jul 2023 14:59:55 -0400 Subject: New data storage key format --- src/ap_state.cpp | 14 +++++++++++--- 1 file 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 { bool connected = false; bool has_connection_result = false; + std::string data_storage_prefix; std::list tracked_data_storage_keys; std::map inventory; @@ -201,6 +202,8 @@ struct APState { tracker_frame->SetStatusMessage("Connected to Archipelago!"); TrackerLog("Connected to Archipelago!"); + data_storage_prefix = + "Lingo_" + std::to_string(apclient->get_player_number()) + "_"; door_shuffle_mode = slot_data["shuffle_doors"].get(); color_shuffle = slot_data["shuffle_colors"].get(); painting_shuffle = slot_data["shuffle_paintings"].get(); @@ -222,8 +225,13 @@ struct APState { RefreshTracker(); - apclient->Get(tracked_data_storage_keys); - apclient->SetNotify(tracked_data_storage_keys); + std::list corrected_keys; + for (const std::string& key : tracked_data_storage_keys) { + corrected_keys.push_back(data_storage_prefix + key); + } + + apclient->Get(corrected_keys); + apclient->SetNotify(corrected_keys); }); apclient->set_slot_refused_handler( @@ -363,7 +371,7 @@ struct APState { } bool HasAchievement(const std::string& name) { - std::string key = "Achievement|" + name; + std::string key = data_storage_prefix + "Achievement|" + name; return data_storage.count(key) && data_storage.at(key); } -- cgit 1.4.1