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.
|
* 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 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
|
// First look for the game using the plugins in memory. This is critical
|
||||||
// for calls coming from inside games
|
// for calls coming from inside games
|
||||||
result = findGameInLoadedPlugins(gameName, plugin);
|
PlainGameDescriptor result = findGameInLoadedPlugins(gameName, plugin);
|
||||||
if (result.gameId) {
|
if (result.gameId) {
|
||||||
return result;
|
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 {
|
PlainGameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin) const {
|
||||||
// Find the GameDescriptor for this target
|
// Find the GameDescriptor for this target
|
||||||
const PluginList &plugins = getPlugins();
|
const PluginList &plugins = getPlugins();
|
||||||
PlainGameDescriptor result;
|
|
||||||
|
|
||||||
if (plugin)
|
if (plugin)
|
||||||
*plugin = 0;
|
*plugin = 0;
|
||||||
|
@ -505,14 +502,15 @@ PlainGameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String
|
||||||
PluginList::const_iterator iter;
|
PluginList::const_iterator iter;
|
||||||
|
|
||||||
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||||
result = (*iter)->get<MetaEngine>().findGame(gameName.c_str());
|
PlainGameDescriptor pgd = (*iter)->get<MetaEngine>().findGame(gameName.c_str());
|
||||||
if (result.gameId) {
|
if (pgd.gameId) {
|
||||||
if (plugin)
|
if (plugin)
|
||||||
*plugin = *iter;
|
*plugin = *iter;
|
||||||
return result;
|
return pgd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
|
return PlainGameDescriptor::empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const {
|
DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const {
|
||||||
|
|
|
@ -589,7 +589,7 @@ PlainGameDescriptor AdvancedMetaEngine::findGame(const char *gameId) const {
|
||||||
return *g;
|
return *g;
|
||||||
|
|
||||||
// No match found
|
// No match found
|
||||||
return PlainGameDescriptor();
|
return PlainGameDescriptor::empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions)
|
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;
|
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() :
|
DetectedGame::DetectedGame() :
|
||||||
engineName(nullptr),
|
engineName(nullptr),
|
||||||
hasUnknownFiles(false),
|
hasUnknownFiles(false),
|
||||||
|
|
|
@ -39,8 +39,8 @@ struct PlainGameDescriptor {
|
||||||
const char *gameId;
|
const char *gameId;
|
||||||
const char *description;
|
const char *description;
|
||||||
|
|
||||||
PlainGameDescriptor() : gameId(nullptr), description(nullptr) {}
|
static PlainGameDescriptor empty();
|
||||||
PlainGameDescriptor(const char *id, const char *desc) : gameId(id), description(desc) {}
|
static PlainGameDescriptor of(const char *gameId, const char *description);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -73,16 +73,16 @@ PlainGameDescriptor findGameID(
|
||||||
if (0 == scumm_stricmp(gameid, o->from)) {
|
if (0 == scumm_stricmp(gameid, o->from)) {
|
||||||
g = findPlainGameDescriptor(o->to, gameids);
|
g = findPlainGameDescriptor(o->to, gameids);
|
||||||
if (g && g->description)
|
if (g && g->description)
|
||||||
return PlainGameDescriptor(gameid, g->description);
|
return PlainGameDescriptor::of(gameid, g->description);
|
||||||
else
|
else
|
||||||
return PlainGameDescriptor(gameid, "Obsolete game ID");
|
return PlainGameDescriptor::of(gameid, "Obsolete game ID");
|
||||||
}
|
}
|
||||||
o++;
|
o++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No match found
|
// No match found
|
||||||
return PlainGameDescriptor();
|
return PlainGameDescriptor::empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Engines
|
} // End of namespace Engines
|
||||||
|
|
|
@ -138,7 +138,7 @@ const ExtraGuiOptions SkyMetaEngine::getExtraGuiOptions(const Common::String &ta
|
||||||
PlainGameDescriptor SkyMetaEngine::findGame(const char *gameid) const {
|
PlainGameDescriptor SkyMetaEngine::findGame(const char *gameid) const {
|
||||||
if (0 == scumm_stricmp(gameid, skySetting.gameId))
|
if (0 == scumm_stricmp(gameid, skySetting.gameId))
|
||||||
return skySetting;
|
return skySetting;
|
||||||
return PlainGameDescriptor();
|
return PlainGameDescriptor::empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
DetectedGames SkyMetaEngine::detectGames(const Common::FSList &fslist) const {
|
DetectedGames SkyMetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||||
|
|
|
@ -140,7 +140,7 @@ PlainGameDescriptor SwordMetaEngine::findGame(const char *gameId) const {
|
||||||
return sword1PSXSettings;
|
return sword1PSXSettings;
|
||||||
if (0 == scumm_stricmp(gameId, sword1PSXDemoSettings.gameId))
|
if (0 == scumm_stricmp(gameId, sword1PSXDemoSettings.gameId))
|
||||||
return sword1PSXDemoSettings;
|
return sword1PSXDemoSettings;
|
||||||
return PlainGameDescriptor();
|
return PlainGameDescriptor::empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound, bool recursion = false) {
|
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;
|
const Sword2::GameSettings *g = Sword2::sword2_settings;
|
||||||
PlainGameList games;
|
PlainGameList games;
|
||||||
while (g->gameid) {
|
while (g->gameid) {
|
||||||
games.push_back(PlainGameDescriptor(g->gameid, g->description));
|
games.push_back(PlainGameDescriptor::of(g->gameid, g->description));
|
||||||
g++;
|
g++;
|
||||||
}
|
}
|
||||||
return games;
|
return games;
|
||||||
|
@ -142,7 +142,7 @@ PlainGameDescriptor Sword2MetaEngine::findGame(const char *gameid) const {
|
||||||
break;
|
break;
|
||||||
g++;
|
g++;
|
||||||
}
|
}
|
||||||
return PlainGameDescriptor(g->gameid, g->description);
|
return PlainGameDescriptor::of(g->gameid, g->description);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFullGame(const Common::FSList &fslist) {
|
bool isFullGame(const Common::FSList &fslist) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue