diff options
author | Bastien Bouclet | 2020-01-01 08:19:48 +0100 |
---|---|---|
committer | Bastien Bouclet | 2020-01-01 08:19:48 +0100 |
commit | 94543467822401b407f4b061268e42d59d6a905b (patch) | |
tree | 09220358172e1e665c66d97e57c368381bab9261 /base | |
parent | 13e0ea0ad47e2863b6e1fa319042507b762621a3 (diff) | |
download | scummvm-rg350-94543467822401b407f4b061268e42d59d6a905b.tar.gz scummvm-rg350-94543467822401b407f4b061268e42d59d6a905b.tar.bz2 scummvm-rg350-94543467822401b407f4b061268e42d59d6a905b.zip |
ENGINES: Copy the data referenced by QualifiedGameDescriptor
The engineId, gameId and description come from static data in the game
engines. When the game engines are compiled as dynamic plugins, the QGD
structure may outlive the engine plugin. Making a copy ensures the data
remains available.
Fixes #11292.
Diffstat (limited to 'base')
-rw-r--r-- | base/commandLine.cpp | 8 | ||||
-rw-r--r-- | base/main.cpp | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp index c8ceea77af..bb7f93a274 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -804,7 +804,7 @@ static void listTargets() { // If there's no description, fallback on the default description. if (description.empty()) { QualifiedGameDescriptor g = EngineMan.findTarget(name); - if (g.description) + if (!g.description.empty()) description = g.description; } // If there's still no description, we cannot come up with one. Insert some dummy text. @@ -854,7 +854,7 @@ static Common::Error listSaves(const Common::String &singleTarget) { currentTarget = *i; EngineMan.upgradeTargetIfNecessary(*i); game = EngineMan.findTarget(*i, &plugin); - } else if (game = findGameMatchingName(*i), game.gameId) { + } else if (game = findGameMatchingName(*i), !game.gameId.empty()) { // The name is a known game id plugin = EngineMan.findPlugin(game.engineId); currentTarget = createTemporaryTarget(game.engineId, game.gameId); @@ -1278,7 +1278,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo QualifiedGameDescriptor gameOption; if (settings.contains("game")) { gameOption = findGameMatchingName(settings["game"]); - if (!gameOption.gameId) { + if (gameOption.gameId.empty()) { usage("Unrecognized game '%s'. Use the --list-games command for a list of accepted values.\n", settings["game"].c_str()); } } @@ -1361,7 +1361,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo if (ConfMan.hasGameDomain(command)) { // Command is a known target ConfMan.setActiveDomain(command); - } else if (gd = findGameMatchingName(command), gd.gameId) { + } else if (gd = findGameMatchingName(command), !gd.gameId.empty()) { // Command is a known game ID Common::String domainName = createTemporaryTarget(gd.engineId, gd.gameId); ConfMan.setActiveDomain(domainName); diff --git a/base/main.cpp b/base/main.cpp index 8121d77c88..66ff457936 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -216,7 +216,7 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common if (caption.empty()) { QualifiedGameDescriptor game = EngineMan.findTarget(ConfMan.getActiveDomainName()); - if (game.description) { + if (!game.description.empty()) { caption = game.description; } } |