From df6e8e88896c5af373d4c4efdd38bb226c4f03d5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 29 Jul 2008 16:16:15 +0000 Subject: Added convenience accessor method GameDescriptor::preferredtarget svn-id: r33414 --- base/game.h | 4 ++++ gui/launcher.cpp | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/base/game.h b/base/game.h index b068c300ce..d81f2afb8a 100644 --- a/base/game.h +++ b/base/game.h @@ -92,6 +92,10 @@ public: const Common::String &description() const { return getVal("description"); } Common::Language language() const { return contains("language") ? Common::parseLanguage(getVal("language")) : Common::UNK_LANG; } Common::Platform platform() const { return contains("platform") ? Common::parsePlatform(getVal("platform")) : Common::kPlatformUnknown; } + + const Common::String &preferredtarget() const { + return contains("preferredtarget") ? getVal("preferredtarget") : getVal("gameid"); + } }; /** List of games. */ diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 4475df5720..34c4ebf474 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -714,12 +714,7 @@ Common::String addGameToConf(const GameDescriptor &result) { // The auto detector or the user made a choice. // Pick a domain name which does not yet exist (after all, we // are *adding* a game to the config, not replacing). - String domain; - - if (result.contains("preferredtarget")) - domain = result["preferredtarget"]; - else - domain = result.gameid(); + String domain = result.preferredtarget(); assert(!domain.empty()); if (ConfMan.hasGameDomain(domain)) { -- cgit v1.2.3