aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2006-03-09 01:42:56 +0000
committerMax Horn2006-03-09 01:42:56 +0000
commitd2f78184af00cd91f3f1f251199a436b53f4ae64 (patch)
tree140adfdc6fd1ae851a1093d4e2cf8056ae361b52 /engines
parent0d4b1a2c8579b88f7ddcf252ab4a317fd6d2576b (diff)
downloadscummvm-rg350-d2f78184af00cd91f3f1f251199a436b53f4ae64.tar.gz
scummvm-rg350-d2f78184af00cd91f3f1f251199a436b53f4ae64.tar.bz2
scummvm-rg350-d2f78184af00cd91f3f1f251199a436b53f4ae64.zip
- added new toDetectedGame() template function (analog to toGameSettings)
- made use of the new DetectedGame constructor from my last commit - some related cleanup svn-id: r21149
Diffstat (limited to 'engines')
-rw-r--r--engines/cine/cine.cpp21
-rw-r--r--engines/gob/gob.cpp6
-rw-r--r--engines/kyra/kyra.cpp2
-rw-r--r--engines/lure/lure.cpp2
-rw-r--r--engines/saga/game.cpp10
-rw-r--r--engines/saga/saga.h5
-rw-r--r--engines/scumm/plugin.cpp19
-rw-r--r--engines/simon/game.cpp10
-rw-r--r--engines/simon/simon.h5
-rw-r--r--engines/sword2/sword2.cpp2
10 files changed, 31 insertions, 51 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 69b1c3af78..d6256debf9 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -75,19 +75,12 @@ static const CINEGameSettings cine_settings[] = {
{NULL, NULL, 0, 0, NULL}
};
-// Keep list of different supported games
-static const GameSettings cine_list[] = {
- {"fw", "Future Wars"},
- {"os", "Operation Stealth"},
- {0, 0}
-};
-
GameList Engine_CINE_gameIDList() {
GameList games;
- const GameSettings *g = cine_list;
+ const CINEGameSettings *g = cine_settings;
- while (g->gameid) {
- games.push_back(*g);
+ while (g->name) {
+ games.push_back(g->toGameSettings());
g++;
}
@@ -95,13 +88,13 @@ GameList Engine_CINE_gameIDList() {
}
GameSettings Engine_CINE_findGameID(const char *gameid) {
- const GameSettings *g = cine_list;
- while (g->gameid) {
- if (0 == scumm_stricmp(gameid, g->gameid))
+ const CINEGameSettings *g = cine_settings;
+ while (g->name) {
+ if (0 == scumm_stricmp(gameid, g->name))
break;
g++;
}
- return *g;
+ return g->toGameSettings();
}
DetectedGameList Engine_CINE_detectGames(const FSList &fslist) {
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index fd21d81415..8c1793ea94 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -60,10 +60,6 @@ struct GobGameSettings {
const char *description;
uint32 features;
const char *md5sum;
- GameSettings toGameSettings() const {
- GameSettings dummy = { gameid, description };
- return dummy;
- }
};
static const GobGameSettings gob_games[] = {
@@ -326,7 +322,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) {
}
for (g = gob_games; g->gameid; g++) {
if (strcmp(g->md5sum, (char *)md5str) == 0) {
- detectedGames.push_back(g->toGameSettings());
+ detectedGames.push_back(DetectedGame(g->gameid, g->description));
}
}
if (detectedGames.isEmpty()) {
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp
index 292bbab980..90ad7b37f0 100644
--- a/engines/kyra/kyra.cpp
+++ b/engines/kyra/kyra.cpp
@@ -181,7 +181,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
}
for (g = kyra_games; g->gameid; g++) {
if (strcmp(g->md5sum, (char *)md5str) == 0) {
- detectedGames.push_back(DetectedGame(toGameSettings(*g), convertKyraLang(g->features), Common::kPlatformUnknown));
+ detectedGames.push_back(DetectedGame(g->gameid, g->description, convertKyraLang(g->features), Common::kPlatformUnknown));
}
}
if (detectedGames.isEmpty()) {
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index d017b0f082..165a3bc15e 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -125,7 +125,7 @@ DetectedGameList Engine_LURE_detectGames(const FSList &fslist) {
}
for (g = lure_games; g->gameid; g++) {
if (strcmp(g->md5sum, (char *)md5str) == 0) {
- detectedGames.push_back(toGameSettings(*g));
+ detectedGames.push_back(toDetectedGame(*g));
}
}
if (detectedGames.isEmpty()) {
diff --git a/engines/saga/game.cpp b/engines/saga/game.cpp
index 5a6ffd88b9..bc38a17179 100644
--- a/engines/saga/game.cpp
+++ b/engines/saga/game.cpp
@@ -1654,10 +1654,12 @@ DetectedGameList GAME_ProbeGame(const FSList &fslist, int **retmatches) {
// and now push them into list of detected games
for (i = 0; i < index; i++)
- if (matches[i] != -1)
- detectedGames.push_back(DetectedGame(gameDescriptions[matches[i]].toGameSettings(),
- gameDescriptions[matches[i]].language,
- gameDescriptions[matches[i]].platform));
+ if (matches[i] != -1) {
+ GameDescription &g = gameDescriptions[matches[i]];
+ detectedGames.push_back(DetectedGame(g.name, g.title,
+ g.language,
+ g.platform));
+ }
if (retmatches) {
*retmatches = (int *)calloc(ARRAYSIZE(gameDescriptions), sizeof(int));
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 2e2c1358f0..938b44e083 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -516,11 +516,6 @@ struct GameDescription {
uint32 features;
Common::Language language;
Common::Platform platform;
-
- GameSettings toGameSettings() const {
- GameSettings dummy = { name, title };
- return dummy;
- }
};
struct SaveFileData {
diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp
index 58d4e8d08c..ceadc3d39c 100644
--- a/engines/scumm/plugin.cpp
+++ b/engines/scumm/plugin.cpp
@@ -861,11 +861,6 @@ static const char *findDescriptionFromGameID(const char *gameid) {
error("Unknown gameid encountered in findDescriptionFromGameID");
}
-static GameSettings toGameSettings(const ScummGameSettings &g) {
- GameSettings dummy = { g.gameid, findDescriptionFromGameID(g.gameid) };
- return dummy;
-}
-
static int compareMD5Table(const void *a, const void *b) {
const char *key = (const char *)a;
const MD5Table *elem = (const MD5Table *)b;
@@ -1139,26 +1134,27 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
}
// Match found, add to list of candidates, then abort inner loop.
+ const char *desc = findDescriptionFromGameID(g->gameid);
if (substLastIndex > 0 && // HE Mac versions.
(subst.genMethod == kGenMac ||
subst.genMethod == kGenMacNoParens)) {
- detectedGames.push_back(DetectedGame(toGameSettings(*g),
+ detectedGames.push_back(DetectedGame(g->gameid, desc,
Common::UNK_LANG,
Common::kPlatformMacintosh));
fileSet[file->path()] = true;
} else if (substLastIndex == 0 && g->id == GID_MANIAC &&
(buf[0] == 0xbc || buf[0] == 0xa0)) {
- detectedGames.push_back(DetectedGame(toGameSettings(*g),
+ detectedGames.push_back(DetectedGame(g->gameid, desc,
Common::UNK_LANG,
Common::kPlatformNES));
} else if ((g->id == GID_MANIAC || g->id == GID_ZAK) &&
((buf[0] == 0x31 && buf[1] == 0x0a) ||
(buf[0] == 0xcd && buf[1] == 0xfe))) {
- detectedGames.push_back(DetectedGame(toGameSettings(*g),
+ detectedGames.push_back(DetectedGame(g->gameid, desc,
Common::UNK_LANG,
Common::kPlatformC64));
} else {
- detectedGames.push_back(toGameSettings(*g));
+ detectedGames.push_back(DetectedGame(g->gameid, desc));
fileSet[file->path()] = false;
}
break;
@@ -1200,10 +1196,11 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
}
assert(g->gameid);
// Insert the 'enhanced' game data into the candidate list
+ const char *desc = findDescriptionFromGameID(g->gameid);
if (iter->_value == true) // This was HE Mac game
- detectedGames.push_back(DetectedGame(toGameSettings(*g), elem->language, Common::kPlatformMacintosh));
+ detectedGames.push_back(DetectedGame(g->gameid, desc, elem->language, Common::kPlatformMacintosh));
else
- detectedGames.push_back(DetectedGame(toGameSettings(*g), elem->language, elem->platform));
+ detectedGames.push_back(DetectedGame(g->gameid, desc, elem->language, elem->platform));
exactMatch = true;
}
}
diff --git a/engines/simon/game.cpp b/engines/simon/game.cpp
index 8539c9559a..748a502455 100644
--- a/engines/simon/game.cpp
+++ b/engines/simon/game.cpp
@@ -1069,10 +1069,12 @@ DetectedGameList GAME_ProbeGame(const FSList &fslist, int **retmatches) {
// and now push them into list of detected games
for (i = 0; i < index; i++)
- if (matches[i] != -1)
- detectedGames.push_back(DetectedGame(gameDescriptions[matches[i]].toGameSettings(),
- gameDescriptions[matches[i]].language,
- gameDescriptions[matches[i]].platform));
+ if (matches[i] != -1) {
+ GameDescription &g = gameDescriptions[matches[i]];
+ detectedGames.push_back(DetectedGame(g.name, g.title,
+ g.language,
+ g.platform));
+ }
if (retmatches) {
*retmatches = (int *)calloc(ARRAYSIZE(gameDescriptions), sizeof(int));
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index 1c0e2a1c84..02199e037f 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -126,11 +126,6 @@ struct GameDescription {
uint32 features;
Common::Language language;
Common::Platform platform;
-
- GameSettings toGameSettings() const {
- GameSettings dummy = { name, title };
- return dummy;
- }
};
DetectedGameList GAME_ProbeGame(const FSList &fslist, int **matches = NULL);
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index e3e7d25bde..a8c9c635e5 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -99,7 +99,7 @@ DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) {
if (0 == scumm_stricmp(g->detectname, gameName)) {
// Match found, add to list of candidates, then abort inner loop.
- detectedGames.push_back(toGameSettings(*g));
+ detectedGames.push_back(toDetectedGame(*g));
break;
}
}