diff options
-rw-r--r-- | common/config-manager.cpp | 45 | ||||
-rw-r--r-- | common/config-manager.h | 3 |
2 files changed, 22 insertions, 26 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 90297779d5..1619f3c295 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -300,33 +300,30 @@ bool ConfigManager::getBool(const String &key, const String &dom) const { #pragma mark - -void ConfigManager::set(const String &key, const String &value) { - // Remove the transient domain value - _transientDomain.remove(key); - - if (_activeDomain.isEmpty()) - _globalDomains[kApplicationDomain][key] = value; - else - _gameDomains[_activeDomain][key] = value; -} - void ConfigManager::set(const String &key, const String &value, const String &dom) { if (dom.isEmpty()) { - set(key, value); - return; - } + // Remove the transient domain value + _transientDomain.remove(key); + + if (_activeDomain.isEmpty()) + _globalDomains[kApplicationDomain][key] = value; + else + _gameDomains[_activeDomain][key] = value; - if (dom == kTransientDomain) - _transientDomain[key] = value; - else { - if (_globalDomains.contains(dom)) { - _globalDomains[dom][key] = value; - if (_activeDomain.isEmpty() || !_gameDomains[_activeDomain].contains(key)) - _transientDomain.remove(key); - } else { - _gameDomains[dom][key] = value; - if (dom == _activeDomain) - _transientDomain.remove(key); + } else { + + if (dom == kTransientDomain) + _transientDomain[key] = value; + else { + if (_globalDomains.contains(dom)) { + _globalDomains[dom][key] = value; + if (_activeDomain.isEmpty() || !_gameDomains[_activeDomain].contains(key)) + _transientDomain.remove(key); + } else { + _gameDomains[dom][key] = value; + if (dom == _activeDomain) + _transientDomain.remove(key); + } } } } diff --git a/common/config-manager.h b/common/config-manager.h index 62e824623b..3a114eba83 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -70,8 +70,7 @@ public: int getInt(const String &key, const String &dom = String::emptyString) const; bool getBool(const String &key, const String &dom = String::emptyString) const; - void set(const String &key, const String &value); - void set(const String &key, const String &value, const String &dom); + void set(const String &key, const String &value, const String &dom = String::emptyString); void set(const String &key, const char *value, const String &dom = String::emptyString); void set(const String &key, int value, const String &dom = String::emptyString); void set(const String &key, bool value, const String &dom = String::emptyString); |