cleanup of game detector functions
svn-id: r11024
This commit is contained in:
parent
7fc1e3ec92
commit
078091e7f4
2 changed files with 9 additions and 17 deletions
13
sky/sky.cpp
13
sky/sky.cpp
|
@ -78,17 +78,12 @@ extern bool draw_keyboard;
|
||||||
|
|
||||||
#undef WITH_DEBUG_CHEATS
|
#undef WITH_DEBUG_CHEATS
|
||||||
|
|
||||||
static const GameSettings sky_settings[] = {
|
static const GameSettings skySetting =
|
||||||
/* Beneath a Steel Sky */
|
{"sky", "Beneath a Steel Sky", MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "sky.dsk" };
|
||||||
{"sky", "Beneath a Steel Sky", MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "sky.dsk" },
|
|
||||||
{NULL, NULL, MDT_NONE, 0, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
GameList Engine_SKY_gameList() {
|
GameList Engine_SKY_gameList() {
|
||||||
const GameSettings *g = sky_settings;
|
|
||||||
GameList games;
|
GameList games;
|
||||||
while (g->gameName)
|
games.push_back(skySetting);
|
||||||
games.push_back(*g++);
|
|
||||||
return games;
|
return games;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +95,7 @@ GameList Engine_SKY_detectGames(const FSList &fslist) {
|
||||||
|
|
||||||
if (0 == scumm_stricmp("sky.dsk", fileName)) {
|
if (0 == scumm_stricmp("sky.dsk", fileName)) {
|
||||||
// Match found, add to list of candidates, then abort inner loop.
|
// Match found, add to list of candidates, then abort inner loop.
|
||||||
detectedGames.push_back(sky_settings[0]);
|
detectedGames.push_back(skySetting);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,20 +74,17 @@ GameList Engine_SWORD2_gameList() {
|
||||||
GameList Engine_SWORD2_detectGames(const FSList &fslist) {
|
GameList Engine_SWORD2_detectGames(const FSList &fslist) {
|
||||||
GameList detectedGames;
|
GameList detectedGames;
|
||||||
const GameSettings *g;
|
const GameSettings *g;
|
||||||
char detectName[128];
|
|
||||||
char detectName2[128];
|
// TODO: It would be nice if we had code here which distinguishes between
|
||||||
|
// the 'sword2' and Ôsword2demoÔ targets. The current code can't do that
|
||||||
|
// since they use the same detectname.
|
||||||
|
|
||||||
for (g = sword2_settings; g->gameName; ++g) {
|
for (g = sword2_settings; g->gameName; ++g) {
|
||||||
strcpy(detectName, g->detectname);
|
|
||||||
strcpy(detectName2, g->detectname);
|
|
||||||
strcat(detectName2, ".");
|
|
||||||
|
|
||||||
// Iterate over all files in the given directory
|
// Iterate over all files in the given directory
|
||||||
for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
|
for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||||
const char *gameName = file->displayName().c_str();
|
const char *gameName = file->displayName().c_str();
|
||||||
|
|
||||||
if ((0 == scumm_stricmp(detectName, gameName)) ||
|
if (0 == scumm_stricmp(g->detectname, gameName)) {
|
||||||
(0 == scumm_stricmp(detectName2, gameName))) {
|
|
||||||
// Match found, add to list of candidates, then abort inner loop.
|
// Match found, add to list of candidates, then abort inner loop.
|
||||||
detectedGames.push_back(*g);
|
detectedGames.push_back(*g);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue