diff options
-rw-r--r-- | base/commandLine.cpp | 18 | ||||
-rw-r--r-- | common/config-manager.cpp | 25 | ||||
-rw-r--r-- | common/config-manager.h | 4 | ||||
-rw-r--r-- | engines/engine.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/detection.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 2 | ||||
-rw-r--r-- | gui/launcher.cpp | 4 | ||||
-rw-r--r-- | gui/massadd.cpp | 2 |
8 files changed, 19 insertions, 44 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp index caefd6e8fe..8846f4bcc6 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -584,7 +584,7 @@ static void listTargets() { ConfigManager::DomainMap::const_iterator iter; for (iter = domains.begin(); iter != domains.end(); ++iter) { Common::String name(iter->_key); - Common::String description(iter->_value.get("description")); + Common::String description(iter->_value.getVal("description")); if (description.empty()) { // FIXME: At this point, we should check for a "gameid" override @@ -617,7 +617,7 @@ static void listSaves(const char *target) { // Grab the gameid from the domain resp. use the target as gameid Common::String gameid; if (domain) - gameid = domain->get("gameid"); + gameid = domain->getVal("gameid"); if (gameid.empty()) gameid = target; gameid.toLowercase(); // Normalize it to lower case @@ -674,8 +674,8 @@ static void runDetectorTest() { int success = 0, failure = 0; for (iter = domains.begin(); iter != domains.end(); ++iter) { Common::String name(iter->_key); - Common::String gameid(iter->_value.get("gameid")); - Common::String path(iter->_value.get("path")); + Common::String gameid(iter->_value.getVal("gameid")); + Common::String path(iter->_value.getVal("path")); printf("Looking at target '%s', gameid '%s', path '%s' ...\n", name.c_str(), gameid.c_str(), path.c_str()); if (path.empty()) { @@ -748,8 +748,8 @@ void upgradeTargets() { for (iter = domains.begin(); iter != domains.end(); ++iter) { Common::ConfigManager::Domain &dom = iter->_value; Common::String name(iter->_key); - Common::String gameid(dom.get("gameid")); - Common::String path(dom.get("path")); + Common::String gameid(dom.getVal("gameid")); + Common::String path(dom.getVal("path")); printf("Looking at target '%s', gameid '%s' ...\n", name.c_str(), gameid.c_str()); if (path.empty()) { @@ -768,9 +768,9 @@ void upgradeTargets() { continue; } - Common::Language lang = Common::parseLanguage(dom.get("language")); - Common::Platform plat = Common::parsePlatform(dom.get("platform")); - Common::String desc(dom.get("description")); + Common::Language lang = Common::parseLanguage(dom.getVal("language")); + Common::Platform plat = Common::parsePlatform(dom.getVal("platform")); + Common::String desc(dom.getVal("description")); GameList candidates(EngineMan.detectGames(files)); GameDescriptor *g = 0; diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 5bb764bbb2..9bef6b37a6 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -390,10 +390,8 @@ const String & ConfigManager::get(const String &key) const { return (*_activeDomain)[key]; else if (_appDomain.contains(key)) return _appDomain[key]; - else if (_defaultsDomain.contains(key)) - return _defaultsDomain[key]; - return _emptyString; + return _defaultsDomain.getVal(key); } const String & ConfigManager::get(const String &key, const String &domName) const { @@ -412,18 +410,7 @@ const String & ConfigManager::get(const String &key, const String &domName) cons if (domain->contains(key)) return (*domain)[key]; - return _defaultsDomain.get(key); - - if (!domain->contains(key)) { -#if 1 - return _emptyString; -#else - error("ConfigManager::get(%s,%s) called on non-existent key", - key.c_str(), domName.c_str()); -#endif - } - - return (*domain)[key]; + return _defaultsDomain.getVal(key); } int ConfigManager::getInt(const String &key, const String &domName) const { @@ -614,14 +601,6 @@ bool ConfigManager::hasGameDomain(const String &domName) const { #pragma mark - -const String &ConfigManager::Domain::get(const String &key) const { - const_iterator iter(find(key)); - if (iter != end()) - return iter->_value; - - return ConfMan._emptyString; -} - void ConfigManager::Domain::setDomainComment(const String &comment) { _domainComment = comment; } diff --git a/common/config-manager.h b/common/config-manager.h index 68c6c4f5ee..350b88b531 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -56,8 +56,6 @@ public: String _domainComment; public: - const String &get(const String &key) const; - void setDomainComment(const String &comment); const String &getDomainComment() const; @@ -165,8 +163,6 @@ private: Domain * _activeDomain; String _filename; - - const String _emptyString; }; } // End of namespace Common diff --git a/engines/engine.cpp b/engines/engine.cpp index a668955c47..8487a42d05 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -123,8 +123,8 @@ void initCommonGFX(bool defaultTo1XScaler) { ( !gameDomain || !gameDomain->contains("gfx_mode") || - !scumm_stricmp(gameDomain->get("gfx_mode").c_str(), "normal") || - !scumm_stricmp(gameDomain->get("gfx_mode").c_str(), "default") + !scumm_stricmp(gameDomain->getVal("gfx_mode").c_str(), "normal") || + !scumm_stricmp(gameDomain->getVal("gfx_mode").c_str(), "default") ); // See if the game should default to 1x scaler diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index be3cd2bf3a..6e9359e7fc 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -1355,7 +1355,7 @@ void KyraMetaEngine::removeSaveState(const char *target, int slot) const { // In Kyra games slot 0 can't be deleted, it's for restarting the game(s). // An exception makes Lands of Lore here, it does not have any way to restart the // game except via its main menu. - if (slot == 0 && !ConfMan.getDomain(target)->get("gameid").equalsIgnoreCase("lol")) + if (slot == 0 && !ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("lol")) return; Common::String filename = Kyra::KyraEngine_v1::getSavegameFilename(target, slot); @@ -1376,7 +1376,7 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s if (error == Kyra::KyraEngine_v1::kRSHENoError) { SaveStateDescriptor desc(slot, header.description); - bool lolGame = ConfMan.getDomain(target)->get("gameid").equalsIgnoreCase("lol"); + bool lolGame = ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("lol"); // Slot 0 is used for the 'restart game' save in all three Kyrandia games, thus // we prevent it from being deleted. diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index bd8e1295ca..4c87ff4173 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -489,7 +489,7 @@ void KyraEngine_v1::registerDefaultSettings() { // the global subtitles settings, we're using this hack to enable subtitles // for fan translations const Common::ConfigManager::Domain *cur = ConfMan.getActiveDomain(); - if (!cur || (cur && cur->get("subtitles").empty())) + if (!cur || (cur && cur->getVal("subtitles").empty())) ConfMan.setBool("subtitles", true); } } diff --git a/gui/launcher.cpp b/gui/launcher.cpp index ae23fe9499..0f484c5233 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -608,8 +608,8 @@ void LauncherDialog::updateListing() { } #endif - String gameid(iter->_value.get("gameid")); - String description(iter->_value.get("description")); + String gameid(iter->_value.getVal("gameid")); + String description(iter->_value.getVal("description")); if (gameid.empty()) gameid = iter->_key; diff --git a/gui/massadd.cpp b/gui/massadd.cpp index 91c1b6c459..266226161a 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -106,7 +106,7 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir) } #endif - Common::String path(iter->_value.get("path")); + Common::String path(iter->_value.getVal("path")); // Remove trailing slash, so that "/foo" and "/foo/" match. // This works around a bug in the POSIX FS code (and others?) // where paths are not normalized (so FSNodes refering to identical |