aboutsummaryrefslogtreecommitdiff
path: root/gui/launcher.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2017-12-03 12:19:08 +0100
committerBastien Bouclet2018-05-10 09:04:23 +0200
commit5aff87dc153f392cb14423efa78a96397789a6fd (patch)
tree66c2fd4a14f4f9a8668499b17e3630f49809f297 /gui/launcher.cpp
parent643c24db75797728087999abd8acf1ecc83757fa (diff)
downloadscummvm-rg350-5aff87dc153f392cb14423efa78a96397789a6fd.tar.gz
scummvm-rg350-5aff87dc153f392cb14423efa78a96397789a6fd.tar.bz2
scummvm-rg350-5aff87dc153f392cb14423efa78a96397789a6fd.zip
ENGINES: Turn GameDescriptor into a simple struct
Diffstat (limited to 'gui/launcher.cpp')
-rw-r--r--gui/launcher.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index f257c53e11..4edd3527f4 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -376,11 +376,20 @@ void LauncherDialog::addGame() {
} while (looping);
}
+namespace {
+
+static void addStringToConf(const Common::String &key, const Common::String &value, const Common::String &domain) {
+ if (!value.empty())
+ ConfMan.set(key, value, domain);
+}
+
+} // End of anonymous namespace
+
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).
- Common::String domain = result.preferredtarget();
+ Common::String domain = result.preferredTarget;
assert(!domain.empty());
if (ConfMan.hasGameDomain(domain)) {
@@ -396,11 +405,15 @@ Common::String addGameToConf(const GameDescriptor &result) {
// Add the name domain
ConfMan.addGameDomain(domain);
- // Copy all non-empty key/value pairs into the new domain
- for (GameDescriptor::const_iterator iter = result.begin(); iter != result.end(); ++iter) {
- if (!iter->_value.empty() && iter->_key != "preferredtarget")
- ConfMan.set(iter->_key, iter->_value, domain);
- }
+ // Copy all non-empty relevant values into the new domain
+ // FIXME: Factor out
+ addStringToConf("gameid", result.gameId, domain);
+ addStringToConf("description", result.description, domain);
+ addStringToConf("language", Common::getLanguageCode(result.language), domain);
+ addStringToConf("platform", Common::getPlatformCode(result.platform), domain);
+ addStringToConf("path", result.path, domain);
+ addStringToConf("extra", result.extra, domain);
+ addStringToConf("guioptions", result.getGUIOptions(), domain);
// TODO: Setting the description field here has the drawback
// that the user does never notice when we upgrade our descriptions.
@@ -601,7 +614,7 @@ bool LauncherDialog::doGameDetection(const Common::String &path) {
// Display the candidates to the user and let her/him pick one
StringArray list;
for (idx = 0; idx < (int)candidates.size(); idx++)
- list.push_back(candidates[idx].matchedGame.description());
+ list.push_back(candidates[idx].matchedGame.description);
ChooserDialog dialog(_("Pick the game:"));
dialog.setList(list);