diff options
author | Max Horn | 2006-03-09 02:52:51 +0000 |
---|---|---|
committer | Max Horn | 2006-03-09 02:52:51 +0000 |
commit | 86565fcca57454e91124410cfd6864ef1e202dc0 (patch) | |
tree | 83cc82217179d56f23836628520b7f63b4a0607d /engines | |
parent | d2f78184af00cd91f3f1f251199a436b53f4ae64 (diff) | |
download | scummvm-rg350-86565fcca57454e91124410cfd6864ef1e202dc0.tar.gz scummvm-rg350-86565fcca57454e91124410cfd6864ef1e202dc0.tar.bz2 scummvm-rg350-86565fcca57454e91124410cfd6864ef1e202dc0.zip |
- Renamed GameSettings to PlainGameDescriptor
- Added new GameDescriptor struct (similar to PlainGameDescriptor but with
Common::String members instead of const char * ones)
- Changed DetectedGame to subclass GameDescriptor
- Removed toGameSettings() in favor of new (template) constructors in
DetectedGame and GameDescriptor
- Fixed a bug in the obsolete gameid handling in the SCUMM & SIMON engines
svn-id: r21150
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cine/cine.cpp | 13 | ||||
-rw-r--r-- | engines/gob/gob.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/kyra.cpp | 10 | ||||
-rw-r--r-- | engines/lure/lure.cpp | 12 | ||||
-rw-r--r-- | engines/queen/queen.cpp | 9 | ||||
-rw-r--r-- | engines/saga/saga.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/plugin.cpp | 27 | ||||
-rw-r--r-- | engines/simon/simon.cpp | 16 | ||||
-rw-r--r-- | engines/sky/sky.cpp | 7 | ||||
-rw-r--r-- | engines/sword1/sword1.cpp | 9 | ||||
-rw-r--r-- | engines/sword2/sword2.cpp | 8 |
11 files changed, 62 insertions, 67 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index d6256debf9..8ec2a86c96 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -63,9 +63,8 @@ struct CINEGameSettings { byte id; uint32 features; const char *detectname; - GameSettings toGameSettings() const { - GameSettings dummy = { name, description }; - return dummy; + GameDescriptor toGameDescriptor() const { + return GameDescriptor(name, description); } }; @@ -80,21 +79,21 @@ GameList Engine_CINE_gameIDList() { const CINEGameSettings *g = cine_settings; while (g->name) { - games.push_back(g->toGameSettings()); + games.push_back(g->toGameDescriptor()); g++; } return games; } -GameSettings Engine_CINE_findGameID(const char *gameid) { +GameDescriptor Engine_CINE_findGameID(const char *gameid) { const CINEGameSettings *g = cine_settings; while (g->name) { if (0 == scumm_stricmp(gameid, g->name)) break; g++; } - return g->toGameSettings(); + return g->toGameDescriptor(); } DetectedGameList Engine_CINE_detectGames(const FSList &fslist) { @@ -109,7 +108,7 @@ DetectedGameList Engine_CINE_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(g->toGameSettings()); + detectedGames.push_back(g->toGameDescriptor()); break; } } diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 8c1793ea94..b1d8ea0783 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -118,7 +118,7 @@ static const GobGameSettings gob_games[] = { }; // Keep list of different supported games -static const GameSettings gob_list[] = { +static const PlainGameDescriptor gob_list[] = { {"gob1", "Gobliiins"}, {"gob2", "Gobliins 2"}, {0, 0} @@ -275,7 +275,7 @@ using namespace Gob; GameList Engine_GOB_gameIDList() { GameList games; - const GameSettings *g = gob_list; + const PlainGameDescriptor *g = gob_list; while (g->gameid) { games.push_back(*g); @@ -285,8 +285,8 @@ GameList Engine_GOB_gameIDList() { return games; } -GameSettings Engine_GOB_findGameID(const char *gameid) { - const GameSettings *g = gob_list; +GameDescriptor Engine_GOB_findGameID(const char *gameid) { + const PlainGameDescriptor *g = gob_list; while (g->gameid) { if (0 == scumm_stricmp(gameid, g->gameid)) break; @@ -328,7 +328,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) { if (detectedGames.isEmpty()) { printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); - const GameSettings *g1 = gob_list; + const PlainGameDescriptor *g1 = gob_list; while (g1->gameid) { detectedGames.push_back(*g1); g1++; diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index 90ad7b37f0..a7eb7f7d7d 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -96,7 +96,7 @@ static const KyraGameSettings kyra_games[] = { }; // Keep list of different supported games -static const GameSettings kyra_list[] = { +static const PlainGameDescriptor kyra_list[] = { { "kyra1", "The Legend of Kyrandia" }, { 0, 0 } }; @@ -131,7 +131,7 @@ static Common::Language convertKyraLang(uint32 features) { GameList Engine_KYRA_gameIDList() { GameList games; - const GameSettings *g = kyra_list; + const PlainGameDescriptor *g = kyra_list; while (g->gameid) { games.push_back(*g); @@ -140,8 +140,8 @@ GameList Engine_KYRA_gameIDList() { return games; } -GameSettings Engine_KYRA_findGameID(const char *gameid) { - const GameSettings *g = kyra_list; +GameDescriptor Engine_KYRA_findGameID(const char *gameid) { + const PlainGameDescriptor *g = kyra_list; while (g->gameid) { if (0 == scumm_stricmp(gameid, g->gameid)) break; @@ -187,7 +187,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) { if (detectedGames.isEmpty()) { printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); - const GameSettings *g1 = kyra_list; + const PlainGameDescriptor *g1 = kyra_list; while (g1->gameid) { detectedGames.push_back(*g1); g1++; diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index 165a3bc15e..bb68befdab 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -68,14 +68,14 @@ static const LureGameSettings lure_games[] = { // Keep list of different supported games -static const GameSettings lure_list[] = { +static const PlainGameDescriptor lure_list[] = { { "lure", "Lure of the Temptress" }, { 0, 0 } }; GameList Engine_LURE_gameIDList() { GameList games; - const GameSettings *g = lure_list; + const PlainGameDescriptor *g = lure_list; while (g->gameid) { games.push_back(*g); @@ -84,8 +84,8 @@ GameList Engine_LURE_gameIDList() { return games; } -GameSettings Engine_LURE_findGameID(const char *gameid) { - const GameSettings *g = lure_list; +GameDescriptor Engine_LURE_findGameID(const char *gameid) { + const PlainGameDescriptor *g = lure_list; while (g->gameid) { if (0 == scumm_stricmp(gameid, g->gameid)) break; @@ -125,13 +125,13 @@ DetectedGameList Engine_LURE_detectGames(const FSList &fslist) { } for (g = lure_games; g->gameid; g++) { if (strcmp(g->md5sum, (char *)md5str) == 0) { - detectedGames.push_back(toDetectedGame(*g)); + detectedGames.push_back(*g); } } if (detectedGames.isEmpty()) { debug("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); - const GameSettings *g1 = lure_list; + const PlainGameDescriptor *g1 = lure_list; while (g1->gameid) { detectedGames.push_back(*g1); g1++; diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index ce90c09426..76aab5b3f4 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -55,7 +55,7 @@ bool isSmartphone(); #endif /* Flight of the Amazon Queen */ -static const GameSettings queen_setting[] = { +static const PlainGameDescriptor queen_setting[] = { { "queen", "Flight of the Amazon Queen" }, { "queen", "Flight of the Amazon Queen (Demo)" }, { "queen", "Flight of the Amazon Queen (Interview)" }, @@ -68,15 +68,14 @@ GameList Engine_QUEEN_gameIDList() { return games; } -GameSettings Engine_QUEEN_findGameID(const char *gameid) { +GameDescriptor Engine_QUEEN_findGameID(const char *gameid) { if (0 == scumm_stricmp(gameid, queen_setting[0].gameid)) return queen_setting[0]; - GameSettings dummy = { 0, 0 }; - return dummy; + return GameDescriptor(); } -GameSettings determineTarget(uint32 size) { +GameDescriptor determineTarget(uint32 size) { switch (size) { case 3724538: //regular demo case 3732177: diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 38b0a91250..9ed9c0f854 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -56,7 +56,7 @@ #include "saga/objectmap.h" #include "saga/resnames.h" -static const GameSettings saga_games[] = { +static const PlainGameDescriptor saga_games[] = { {"ite", "Inherit the Earth"}, {"ihnm", "I Have No Mouth and I Must Scream"}, {0, 0} @@ -64,7 +64,7 @@ static const GameSettings saga_games[] = { GameList Engine_SAGA_gameIDList() { GameList games; - const GameSettings *g = saga_games; + const PlainGameDescriptor *g = saga_games; while (g->gameid) { games.push_back(*g); @@ -74,8 +74,8 @@ GameList Engine_SAGA_gameIDList() { return games; } -GameSettings Engine_SAGA_findGameID(const char *gameid) { - const GameSettings *g = saga_games; +GameDescriptor Engine_SAGA_findGameID(const char *gameid) { + const PlainGameDescriptor *g = saga_games; while (g->gameid) { if (0 == scumm_stricmp(gameid, g->gameid)) break; diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp index ceadc3d39c..ed9dc54a6e 100644 --- a/engines/scumm/plugin.cpp +++ b/engines/scumm/plugin.cpp @@ -55,7 +55,6 @@ enum { kMD5FileSizeLimit = 1024 * 1024 }; - struct ObsoleteGameID { const char *from; const char *to; @@ -75,7 +74,7 @@ static const Common::Platform UNK = Common::kPlatformUnknown; * This table contains all game IDs supported by the SCUMM engine, and maps * them to the full humand readable game name. */ -static const GameSettings gameDescriptions[] = { +static const PlainGameDescriptor gameDescriptions[] = { { "atlantis", "Indiana Jones and the Fate of Atlantis" }, { "indy3", "Indiana Jones and the Last Crusade" }, { "loom", "Loom" }, @@ -851,7 +850,7 @@ static const ScummGameSettings multiple_versions_md5_settings[] = { static const char *findDescriptionFromGameID(const char *gameid) { - const GameSettings *g = gameDescriptions; + const PlainGameDescriptor *g = gameDescriptions; while (g->gameid) { if (!scumm_stricmp(g->gameid, gameid)) { return g->description; @@ -874,32 +873,32 @@ static int compareMD5Table(const void *a, const void *b) { GameList Engine_SCUMM_gameIDList() { - const GameSettings *g = gameDescriptions; + const PlainGameDescriptor *g = gameDescriptions; GameList games; while (g->gameid) { - games.push_back(*g); + games.push_back(GameDescriptor(g->gameid, g->description)); g++; } return games; } -GameSettings Engine_SCUMM_findGameID(const char *gameid) { +GameDescriptor Engine_SCUMM_findGameID(const char *gameid) { // First search the list of supported game IDs. - const GameSettings *g = gameDescriptions; + const PlainGameDescriptor *g = gameDescriptions; while (g->gameid) { if (0 == scumm_stricmp(gameid, g->gameid)) - return *g; + return GameDescriptor(g->gameid, g->description); g++; } // If we didn't find the gameid in the main list, check if it // is an obsolete game id. - GameSettings gs = { 0, 0 }; + GameDescriptor gs; const ObsoleteGameID *o = obsoleteGameIDsTable; while (o->from) { if (0 == scumm_stricmp(gameid, o->from)) { gs.gameid = gameid; - gs.gameid = "Obsolete game ID"; + gs.description = "Obsolete game ID"; return gs; } o++; @@ -1072,7 +1071,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { if we find something which has an unknown MD5, assume that it is an (so far unknown) version of Indy3. - We can combin this with a look at the resource headers: + We can combine this with a look at the resource headers: Indy3: _numGlobalObjects 1000 @@ -1189,7 +1188,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { const char *gameid = elem->gameid; - // Find the GameSettings for that gameid + // Find the GameDescriptor for that gameid for (g = scumm_settings; g->gameid; ++g) { if (0 == scumm_stricmp(g->gameid, gameid)) break; @@ -1318,7 +1317,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { } // Now search our 'database' for the MD5; if a match is found, we use - // the information in the 'database' to correct the GameSettings. + // the information in the 'database' to correct the GameDescriptor. g = multiple_versions_md5_settings; while (g->gameid) { if (!scumm_stricmp(md5, g->gameid)) { @@ -1366,7 +1365,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { if (!elem) printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5); - // Finally, we have massaged the GameSettings to our satisfaction, and can + // Finally, we have massaged the GameDescriptor to our satisfaction, and can // instantiate the appropriate game engine. Hooray! switch (game.version) { case 1: diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index fb20351072..04ffdc0a2d 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -76,7 +76,7 @@ static const ObsoleteGameID obsoleteGameIDsTable[] = { {NULL, NULL, Common::kPlatformUnknown} }; -static const GameSettings simonGames[] = { +static const PlainGameDescriptor simonGames[] = { // Simon the Sorcerer 1 & 2 {"feeble", "The Feeble Files"}, {"simon1", "Simon the Sorcerer 1"}, @@ -87,32 +87,32 @@ static const GameSettings simonGames[] = { GameList Engine_SIMON_gameIDList() { GameList games; - const GameSettings *g = simonGames; + const PlainGameDescriptor *g = simonGames; while (g->gameid) { - games.push_back(*g); + games.push_back(GameDescriptor(g->gameid, g->description)); g++; } return games; } -GameSettings Engine_SIMON_findGameID(const char *gameid) { +GameDescriptor Engine_SIMON_findGameID(const char *gameid) { // First search the list of supported game IDs. - const GameSettings *g = simonGames; + const PlainGameDescriptor *g = simonGames; while (g->gameid) { if (0 == scumm_stricmp(gameid, g->gameid)) - return *g; + return GameDescriptor(g->gameid, g->description); g++; } // If we didn't find the gameid in the main list, check if it // is an obsolete game id. - GameSettings gs = { 0, 0 }; + GameDescriptor gs; const ObsoleteGameID *o = obsoleteGameIDsTable; while (o->from) { if (0 == scumm_stricmp(gameid, o->from)) { gs.gameid = gameid; - gs.gameid = "Obsolete game ID"; + gs.description = "Obsolete game ID"; return gs; } o++; diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index 8b944c580f..e99d23275b 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -77,7 +77,7 @@ extern bool isSmartphone(void); With apologies to the CD32 SteelSky file. */ -static const GameSettings skySetting = +static const PlainGameDescriptor skySetting = {"sky", "Beneath a Steel Sky" }; GameList Engine_SKY_gameIDList() { @@ -86,11 +86,10 @@ GameList Engine_SKY_gameIDList() { return games; } -GameSettings Engine_SKY_findGameID(const char *gameid) { +GameDescriptor Engine_SKY_findGameID(const char *gameid) { if (0 == scumm_stricmp(gameid, skySetting.gameid)) return skySetting; - GameSettings dummy = { 0, 0 }; - return dummy; + return GameDescriptor(); } DetectedGameList Engine_SKY_detectGames(const FSList &fslist) { diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index 426b85dea3..6fd0254af4 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -48,9 +48,9 @@ using namespace Sword1; /* Broken Sword 1 */ -static const GameSettings sword1FullSettings = +static const PlainGameDescriptor sword1FullSettings = {"sword1", "Broken Sword 1: The Shadow of the Templars"}; -static const GameSettings sword1DemoSettings = +static const PlainGameDescriptor sword1DemoSettings = {"sword1demo", "Broken Sword 1: The Shadow of the Templars (Demo)"}; // check these subdirectories (if present) @@ -73,13 +73,12 @@ GameList Engine_SWORD1_gameIDList() { return games; } -GameSettings Engine_SWORD1_findGameID(const char *gameid) { +GameDescriptor Engine_SWORD1_findGameID(const char *gameid) { if (0 == scumm_stricmp(gameid, sword1FullSettings.gameid)) return sword1FullSettings; if (0 == scumm_stricmp(gameid, sword1DemoSettings.gameid)) return sword1DemoSettings; - GameSettings dummy = { 0, 0 }; - return dummy; + return GameDescriptor(); } void Sword1CheckDirectory(const FSList &fslist, bool *filesFound) { diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index a8c9c635e5..8d74e94e45 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -67,20 +67,20 @@ GameList Engine_SWORD2_gameIDList() { const Sword2GameSettings *g = sword2_settings; GameList games; while (g->gameid) { - games.push_back(toGameSettings(*g)); + games.push_back(*g); g++; } return games; } -GameSettings Engine_SWORD2_findGameID(const char *gameid) { +GameDescriptor Engine_SWORD2_findGameID(const char *gameid) { const Sword2GameSettings *g = sword2_settings; while (g->gameid) { if (0 == scumm_stricmp(gameid, g->gameid)) break; g++; } - return toGameSettings(*g); + return *g; } DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) { @@ -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(toDetectedGame(*g)); + detectedGames.push_back(*g); break; } } |