diff options
author | Max Horn | 2003-11-11 00:26:38 +0000 |
---|---|---|
committer | Max Horn | 2003-11-11 00:26:38 +0000 |
commit | b38995b288f2c5014ff1a9867d12807182ceb051 (patch) | |
tree | a329d4e044e35cfac98137786c0702c793819547 /common | |
parent | 22c22d1e81b25c103100b6c8347b154f16dafc5e (diff) | |
download | scummvm-rg350-b38995b288f2c5014ff1a9867d12807182ceb051.tar.gz scummvm-rg350-b38995b288f2c5014ff1a9867d12807182ceb051.tar.bz2 scummvm-rg350-b38995b288f2c5014ff1a9867d12807182ceb051.zip |
cleanup (merged the two base set() methods)
svn-id: r11256
Diffstat (limited to 'common')
-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); |