From 42c8cacde64abe526bba656491bd5c9909a7cb94 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Thu, 13 Jan 2011 11:30:37 +0000 Subject: CONFIGMANAGER: small changes to support old config files with no 'gameId' keys. As discussed on -devel. svn-id: r55222 --- common/config-manager.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 9f3f66f12c..a6fc67107e 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -131,6 +131,12 @@ void ConfigManager::addDomain(const Common::String &domainName, const ConfigMana _gameDomains[domainName] = domain; _domainSaveOrder.push_back(domainName); + + // Check if we have the same misc domain. For older config files + // we could have 'ghost' domains with the same name, so delete + // the ghost domain + if (_miscDomains.contains(domainName)) + _miscDomains.erase(domainName); } else { // Otherwise it's a miscellaneous domain if (_miscDomains.contains(domainName)) @@ -355,10 +361,10 @@ const ConfigManager::Domain *ConfigManager::getDomain(const String &domName) con if (domName == kKeymapperDomain) return &_keymapperDomain; #endif - if (_miscDomains.contains(domName)) - return &_miscDomains[domName]; if (_gameDomains.contains(domName)) return &_gameDomains[domName]; + if (_miscDomains.contains(domName)) + return &_miscDomains[domName]; return 0; } @@ -375,10 +381,10 @@ ConfigManager::Domain *ConfigManager::getDomain(const String &domName) { if (domName == kKeymapperDomain) return &_keymapperDomain; #endif - if (_miscDomains.contains(domName)) - return &_miscDomains[domName]; if (_gameDomains.contains(domName)) return &_gameDomains[domName]; + if (_miscDomains.contains(domName)) + return &_miscDomains[domName]; return 0; } -- cgit v1.2.3