ENGINES: Remove usage of C++11 extended initializer lists
This commit is contained in:
parent
2fe060e5c9
commit
1dcb8076db
8 changed files with 30 additions and 18 deletions
|
@ -459,11 +459,9 @@ DECLARE_SINGLETON(EngineManager);
|
|||
* and only if we can't find it there, we loop through the plugins.
|
||||
**/
|
||||
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);
|
||||
PlainGameDescriptor result = findGameInLoadedPlugins(gameName, plugin);
|
||||
if (result.gameId) {
|
||||
return result;
|
||||
}
|
||||
|
@ -497,7 +495,6 @@ PlainGameDescriptor EngineManager::findGame(const Common::String &gameName, cons
|
|||
PlainGameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin) const {
|
||||
// Find the GameDescriptor for this target
|
||||
const PluginList &plugins = getPlugins();
|
||||
PlainGameDescriptor result;
|
||||
|
||||
if (plugin)
|
||||
*plugin = 0;
|
||||
|
@ -505,14 +502,15 @@ PlainGameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String
|
|||
PluginList::const_iterator iter;
|
||||
|
||||
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||
result = (*iter)->get<MetaEngine>().findGame(gameName.c_str());
|
||||
if (result.gameId) {
|
||||
PlainGameDescriptor pgd = (*iter)->get<MetaEngine>().findGame(gameName.c_str());
|
||||
if (pgd.gameId) {
|
||||
if (plugin)
|
||||
*plugin = *iter;
|
||||
return result;
|
||||
return pgd;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
return PlainGameDescriptor::empty();
|
||||
}
|
||||
|
||||
DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const {
|
||||
|
|
|
@ -589,7 +589,7 @@ PlainGameDescriptor AdvancedMetaEngine::findGame(const char *gameId) const {
|
|||
return *g;
|
||||
|
||||
// No match found
|
||||
return PlainGameDescriptor();
|
||||
return PlainGameDescriptor::empty();
|
||||
}
|
||||
|
||||
AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions)
|
||||
|
|
|
@ -35,6 +35,20 @@ const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const Pla
|
|||
return 0;
|
||||
}
|
||||
|
||||
PlainGameDescriptor PlainGameDescriptor::empty() {
|
||||
PlainGameDescriptor pgd;
|
||||
pgd.gameId = nullptr;
|
||||
pgd.description = nullptr;
|
||||
return pgd;
|
||||
}
|
||||
|
||||
PlainGameDescriptor PlainGameDescriptor::of(const char *gameId, const char *description) {
|
||||
PlainGameDescriptor pgd;
|
||||
pgd.gameId = gameId;
|
||||
pgd.description = description;
|
||||
return pgd;
|
||||
}
|
||||
|
||||
DetectedGame::DetectedGame() :
|
||||
engineName(nullptr),
|
||||
hasUnknownFiles(false),
|
||||
|
|
|
@ -39,8 +39,8 @@ struct PlainGameDescriptor {
|
|||
const char *gameId;
|
||||
const char *description;
|
||||
|
||||
PlainGameDescriptor() : gameId(nullptr), description(nullptr) {}
|
||||
PlainGameDescriptor(const char *id, const char *desc) : gameId(id), description(desc) {}
|
||||
static PlainGameDescriptor empty();
|
||||
static PlainGameDescriptor of(const char *gameId, const char *description);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,16 +73,16 @@ PlainGameDescriptor findGameID(
|
|||
if (0 == scumm_stricmp(gameid, o->from)) {
|
||||
g = findPlainGameDescriptor(o->to, gameids);
|
||||
if (g && g->description)
|
||||
return PlainGameDescriptor(gameid, g->description);
|
||||
return PlainGameDescriptor::of(gameid, g->description);
|
||||
else
|
||||
return PlainGameDescriptor(gameid, "Obsolete game ID");
|
||||
return PlainGameDescriptor::of(gameid, "Obsolete game ID");
|
||||
}
|
||||
o++;
|
||||
}
|
||||
}
|
||||
|
||||
// No match found
|
||||
return PlainGameDescriptor();
|
||||
return PlainGameDescriptor::empty();
|
||||
}
|
||||
|
||||
} // End of namespace Engines
|
||||
|
|
|
@ -138,7 +138,7 @@ const ExtraGuiOptions SkyMetaEngine::getExtraGuiOptions(const Common::String &ta
|
|||
PlainGameDescriptor SkyMetaEngine::findGame(const char *gameid) const {
|
||||
if (0 == scumm_stricmp(gameid, skySetting.gameId))
|
||||
return skySetting;
|
||||
return PlainGameDescriptor();
|
||||
return PlainGameDescriptor::empty();
|
||||
}
|
||||
|
||||
DetectedGames SkyMetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||
|
|
|
@ -140,7 +140,7 @@ PlainGameDescriptor SwordMetaEngine::findGame(const char *gameId) const {
|
|||
return sword1PSXSettings;
|
||||
if (0 == scumm_stricmp(gameId, sword1PSXDemoSettings.gameId))
|
||||
return sword1PSXDemoSettings;
|
||||
return PlainGameDescriptor();
|
||||
return PlainGameDescriptor::empty();
|
||||
}
|
||||
|
||||
void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound, bool recursion = false) {
|
||||
|
|
|
@ -123,7 +123,7 @@ PlainGameList Sword2MetaEngine::getSupportedGames() const {
|
|||
const Sword2::GameSettings *g = Sword2::sword2_settings;
|
||||
PlainGameList games;
|
||||
while (g->gameid) {
|
||||
games.push_back(PlainGameDescriptor(g->gameid, g->description));
|
||||
games.push_back(PlainGameDescriptor::of(g->gameid, g->description));
|
||||
g++;
|
||||
}
|
||||
return games;
|
||||
|
@ -142,7 +142,7 @@ PlainGameDescriptor Sword2MetaEngine::findGame(const char *gameid) const {
|
|||
break;
|
||||
g++;
|
||||
}
|
||||
return PlainGameDescriptor(g->gameid, g->description);
|
||||
return PlainGameDescriptor::of(g->gameid, g->description);
|
||||
}
|
||||
|
||||
bool isFullGame(const Common::FSList &fslist) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue