diff options
author | Max Horn | 2003-11-07 15:57:36 +0000 |
---|---|---|
committer | Max Horn | 2003-11-07 15:57:36 +0000 |
commit | ced5921ac08e0c352f0f4d41bbafcfa2282adb67 (patch) | |
tree | 53e4f5e782db4feaadcf700ab42214e7d7b19cc0 /common | |
parent | c0fe2a5da3cc84c8802517815d0822341e81cb0e (diff) | |
download | scummvm-rg350-ced5921ac08e0c352f0f4d41bbafcfa2282adb67.tar.gz scummvm-rg350-ced5921ac08e0c352f0f4d41bbafcfa2282adb67.tar.bz2 scummvm-rg350-ced5921ac08e0c352f0f4d41bbafcfa2282adb67.zip |
change behaviour of ConfigManager::get once again -> now we *do* fall back to the registered defaults...
svn-id: r11195
Diffstat (limited to 'common')
-rw-r--r-- | common/config-manager.cpp | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 3f02798f46..2c69566acf 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -253,6 +253,10 @@ void ConfigManager::removeKey(const String &key, const String &dom) { const String & ConfigManager::get(const String &key) const { + return get(key, _activeDomain); +} + +const String & ConfigManager::get(const String &key, const String &dom) const { // Search the domains in the following order: // 1) Run time domain // 2) Active game domain (if any) @@ -262,9 +266,9 @@ const String & ConfigManager::get(const String &key) const { // if (_transientDomain.contain(key)) // return true; - if (!_activeDomain.isEmpty() && _gameDomains[_activeDomain].contains(key)) - return _gameDomains[_activeDomain][key]; - + if (!dom.isEmpty() && _gameDomains.contains(dom) && _gameDomains[dom].contains(key)) + return _gameDomains[dom][key]; + DomainMap::ConstIterator iter; for (iter = _globalDomains.begin(); iter != _globalDomains.end(); ++iter) { if (iter->_value.contains(key)) @@ -274,32 +278,6 @@ const String & ConfigManager::get(const String &key) const { return _defaultsDomain.get(key); } -const String & ConfigManager::get(const String &key, const String &dom) const { - if (dom.isEmpty()) - return get(key); - - // TODO: How exactly should we handle the case were the domain 'dom' - // is not found, or were dom is found, but doesn't contain 'key' ? - // Right now we just return an empty string. But might want to print - // out a warning, or even error out? - if (_gameDomains.contains(dom)) { - // Return the value, if any; defaults to the empty string if the key is - // not present in the domain. We purposely do not return the registered - // default value. - // - return _gameDomains[dom].get(key); - } else if (_globalDomains.contains(dom)) { - if (_globalDomains[dom].contains(key)) - return _globalDomains[dom].get(key); - // For global domains, we *do* use the registered default value. - return _defaultsDomain.get(key); - } else { - // Domain was not found. Do *not* return the registered default - // value, see above for the reasons. - return String::emptyString; - } -} - int ConfigManager::getInt(const String &key, const String &dom) const { String value(get(key, dom)); // Convert the string to an integer. |