From c1841e3fe84fcffd896b282b3596a696b5a717b7 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Sun, 11 Feb 2018 07:28:11 +1100 Subject: [PATCH] Addon Manager: serialize local_only info key This fixes an issue that's probably existed since Feb. 2017 (187731cedfd3351f2): after installing any addon, local publishable addons get considered "Published", instead of "Ready to Publish". This was because when the addon map was recreated, it did so from the saved config. and the is-local info was lost, and so the game considered its state ADDON_INSTALLED instead of ADDON_INSTALLED_LOCAL_ONLY. Keeping is_local= in the addon's config entry means addon_info::local_only is properly set beyond the initial setup. --- src/addon/info.cpp | 2 ++ src/gui/dialogs/addon/manager.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/addon/info.cpp b/src/addon/info.cpp index 7a1e17ead57d..3e8bd46c90c1 100644 --- a/src/addon/info.cpp +++ b/src/addon/info.cpp @@ -83,6 +83,8 @@ void addon_info::read(const config& cfg) this->updated = cfg["timestamp"].to_time_t(); this->created = cfg["original_timestamp"].to_time_t(); + + this->local_only = cfg["local_only"].to_bool(); } void addon_info::write(config& cfg) const diff --git a/src/gui/dialogs/addon/manager.cpp b/src/gui/dialogs/addon/manager.cpp index 1ca4eca2b6b1..0d7c21b8c611 100644 --- a/src/gui/dialogs/addon/manager.cpp +++ b/src/gui/dialogs/addon/manager.cpp @@ -475,13 +475,15 @@ void addon_manager::load_addon_list(window& window) if(addons_.find(id) == addons_.end()) { // Get a config from the addon's pbl file // Note that the name= key is necessary or stuff breaks, since the filter code uses this key - // to match add-ons in the config list. It also fills in addon_info's id field. + // to match add-ons in the config list. It also fills in addon_info's id field. It's also + // neccessay to set local_only here so that flag can be properly set after addons_ is cleared + // and recreated by read_addons_list. config pbl_cfg = get_addon_pbl_info(id); pbl_cfg["name"] = id; + pbl_cfg["local_only"] = true; // Add the add-on to the list. addon_info addon(pbl_cfg); - addon.local_only = true; addons_[id] = addon; // Add the addon to the config entry