diff options
author | Bastien Bouclet | 2018-05-06 12:57:08 +0200 |
---|---|---|
committer | Bastien Bouclet | 2018-05-10 09:04:23 +0200 |
commit | 8fb149e3c7603f023dfccf2b2056a9a2fda431c2 (patch) | |
tree | a758cefc70a784a65045d09d96f44ed1c16abbb8 /base | |
parent | cf1ebf29516bd74927fd7b632b72fd8973f72e98 (diff) | |
download | scummvm-rg350-8fb149e3c7603f023dfccf2b2056a9a2fda431c2.tar.gz scummvm-rg350-8fb149e3c7603f023dfccf2b2056a9a2fda431c2.tar.bz2 scummvm-rg350-8fb149e3c7603f023dfccf2b2056a9a2fda431c2.zip |
ENGINES: Change MetaEngine::findGame to return a plain game descriptor
Diffstat (limited to 'base')
-rw-r--r-- | base/commandLine.cpp | 14 | ||||
-rw-r--r-- | base/main.cpp | 9 | ||||
-rw-r--r-- | base/plugins.cpp | 16 |
3 files changed, 21 insertions, 18 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 8e701408ef..0755165094 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -714,10 +714,10 @@ static void listTargets() { // FIXME: At this point, we should check for a "gameid" override // to find the proper desc. In fact, the platform probably should // be taken into account, too. - Common::String gameid(name); - GameDescriptor g = EngineMan.findGame(gameid); - if (g.description().size() > 0) - description = g.description(); + const Common::String &gameid = name; + PlainGameDescriptor g = EngineMan.findGame(gameid); + if (g.description) + description = g.description; } targets.push_back(Common::String::format("%-20s %s", name.c_str(), description.c_str())); @@ -770,7 +770,7 @@ static Common::Error listSaves(const Common::String &target) { // Find the plugin that will handle the specified gameid const Plugin *plugin = nullptr; - GameDescriptor game = EngineMan.findGame(gameid, &plugin); + EngineMan.findGame(gameid, &plugin); if (!plugin) { // If the target was specified, treat this as an error, and otherwise skip it. @@ -1276,8 +1276,8 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo // domain (i.e. a target) matching this argument, or alternatively // whether there is a gameid matching that name. if (!command.empty()) { - GameDescriptor gd = EngineMan.findGame(command); - if (ConfMan.hasGameDomain(command) || !gd.gameid().empty()) { + PlainGameDescriptor gd = EngineMan.findGame(command); + if (ConfMan.hasGameDomain(command) || gd.gameId) { bool idCameFromCommandLine = false; // WORKAROUND: Fix for bug #1719463: "DETECTOR: Launching diff --git a/base/main.cpp b/base/main.cpp index 8e783c9776..385b8f35a9 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -128,13 +128,13 @@ static const Plugin *detectPlugin() { printf("User picked target '%s' (gameid '%s')...\n", ConfMan.getActiveDomainName().c_str(), gameid.c_str()); printf(" Looking for a plugin supporting this gameid... "); - GameDescriptor game = EngineMan.findGame(gameid, &plugin); + PlainGameDescriptor game = EngineMan.findGame(gameid, &plugin); if (plugin == 0) { printf("failed\n"); warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str()); } else { - printf("%s\n Starting '%s'\n", plugin->getName(), game.description().c_str()); + printf("%s\n Starting '%s'\n", plugin->getName(), game.description); } return plugin; @@ -210,7 +210,10 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common Common::String caption(ConfMan.get("description")); if (caption.empty()) { - caption = EngineMan.findGame(ConfMan.get("gameid")).description(); + PlainGameDescriptor game = EngineMan.findGame(ConfMan.get("gameid")); + if (game.description) { + caption = game.description; + } } if (caption.empty()) caption = ConfMan.getActiveDomainName(); // Use the domain (=target) name diff --git a/base/plugins.cpp b/base/plugins.cpp index 02f6998ad9..25dd3e1e0c 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -458,13 +458,13 @@ DECLARE_SINGLETON(EngineManager); * For the uncached version, we first try to find the plugin using the gameId * and only if we can't find it there, we loop through the plugins. **/ -GameDescriptor EngineManager::findGame(const Common::String &gameName, const Plugin **plugin) const { - GameDescriptor result; +PlainGameDescriptor EngineManager::findGame(const Common::String &gameName, const Plugin **plugin) const { + PlainGameDescriptor result; // First look for the game using the plugins in memory. This is critical // for calls coming from inside games result = findGameInLoadedPlugins(gameName, plugin); - if (!result.gameid().empty()) { + if (result.gameId) { return result; } @@ -472,7 +472,7 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Plu // by plugin if (PluginMan.loadPluginFromGameId(gameName)) { result = findGameInLoadedPlugins(gameName, plugin); - if (!result.gameid().empty()) { + if (result.gameId) { return result; } } @@ -481,7 +481,7 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Plu PluginMan.loadFirstPlugin(); do { result = findGameInLoadedPlugins(gameName, plugin); - if (!result.gameid().empty()) { + if (result.gameId) { // Update with new plugin file name PluginMan.updateConfigWithFileName(gameName); break; @@ -494,10 +494,10 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Plu /** * Find the game within the plugins loaded in memory **/ -GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin) const { +PlainGameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin) const { // Find the GameDescriptor for this target const PluginList &plugins = getPlugins(); - GameDescriptor result; + PlainGameDescriptor result; if (plugin) *plugin = 0; @@ -506,7 +506,7 @@ GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &game for (iter = plugins.begin(); iter != plugins.end(); ++iter) { result = (*iter)->get<MetaEngine>().findGame(gameName.c_str()); - if (!result.gameid().empty()) { + if (result.gameId) { if (plugin) *plugin = *iter; return result; |