diff options
author | Max Horn | 2006-04-29 00:27:20 +0000 |
---|---|---|
committer | Max Horn | 2006-04-29 00:27:20 +0000 |
commit | bf7359881115a5b041028b032ee28430bc5e36d3 (patch) | |
tree | 78c955620bb16d4b4e39f3b887eed35dd552c57b /engines | |
parent | b00262a2fe1b8bf1d51794a9da3e735e97dfb5ee (diff) | |
download | scummvm-rg350-bf7359881115a5b041028b032ee28430bc5e36d3.tar.gz scummvm-rg350-bf7359881115a5b041028b032ee28430bc5e36d3.tar.bz2 scummvm-rg350-bf7359881115a5b041028b032ee28430bc5e36d3.zip |
* Changed the createEngine() factory function of our plugins to return an error code (the engine is now passed indirectly via a double pointer)
* Removed Engine_Empty (obsolete now that engines can return actual error codes)
svn-id: r22199
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cine/cine.cpp | 6 | ||||
-rw-r--r-- | engines/gob/gob.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/kyra.cpp | 6 | ||||
-rw-r--r-- | engines/lure/lure.cpp | 6 | ||||
-rw-r--r-- | engines/queen/queen.cpp | 6 | ||||
-rw-r--r-- | engines/saga/game.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/plugin.cpp | 45 | ||||
-rw-r--r-- | engines/simon/game.cpp | 6 | ||||
-rw-r--r-- | engines/sky/sky.cpp | 6 | ||||
-rw-r--r-- | engines/sword1/sword1.cpp | 6 | ||||
-rw-r--r-- | engines/sword2/sword2.cpp | 6 |
11 files changed, 63 insertions, 42 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 9f504b76f0..cb61fbf1cd 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -110,8 +110,10 @@ DetectedGameList Engine_CINE_detectGames(const FSList &fslist) { return detectedGames; } -Engine *Engine_CINE_create(OSystem *syst) { - return new Cine::CineEngine(syst); +PluginError Engine_CINE_create(OSystem *syst, Engine **engine) { + assert(engine); + *engine = new Cine::CineEngine(syst); + return kNoError; } REGISTER_PLUGIN(CINE, "CINE Engine"); diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 108368006e..6fd6255a9a 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -361,7 +361,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) { return detectedGames; } -Engine *Engine_GOB_create(OSystem *syst) { +PluginError Engine_GOB_create(OSystem *syst, Engine **engine) { // Detect game features based on MD5 uint8 md5sum[16]; char md5str[32 + 1]; @@ -403,7 +403,9 @@ Engine *Engine_GOB_create(OSystem *syst) { printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); } - return new GobEngine(syst, features, g->lang); + assert(engine); + *engine = new GobEngine(syst, features, g->lang); + return kNoError; } REGISTER_PLUGIN(GOB, "Gob Engine"); diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index 920f5c02a2..81a73db6f7 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -204,8 +204,10 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) { return detectedGames; } -Engine *Engine_KYRA_create(OSystem *system) { - return new KyraEngine(system); +PluginError Engine_KYRA_create(OSystem *syst, Engine **engine) { + assert(engine); + *engine = new KyraEngine(syst); + return kNoError; } REGISTER_PLUGIN(KYRA, "Legend of Kyrandia Engine"); diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index 5ec33994a3..dab02a5ca3 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -154,8 +154,10 @@ DetectedGameList Engine_LURE_detectGames(const FSList &fslist) { return detectedGames; } -Engine *Engine_LURE_create(OSystem *system) { - return new LureEngine(system); +PluginError Engine_LURE_create(OSystem *syst, Engine **engine) { + assert(engine); + *engine = new LureEngine(syst); + return kNoError; } REGISTER_PLUGIN(LURE, "Lure of the Temptress Engine"); diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index 611832c439..129d8358c2 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -128,8 +128,10 @@ DetectedGameList Engine_QUEEN_detectGames(const FSList &fslist) { return detectedGames; } -Engine *Engine_QUEEN_create(OSystem *syst) { - return new Queen::QueenEngine(syst); +PluginError Engine_QUEEN_create(OSystem *syst, Engine **engine) { + assert(engine); + *engine = new Queen::QueenEngine(syst); + return kNoError; } REGISTER_PLUGIN(QUEEN, "Flight of the Amazon Queen"); diff --git a/engines/saga/game.cpp b/engines/saga/game.cpp index e9b215e99d..cad25c7aff 100644 --- a/engines/saga/game.cpp +++ b/engines/saga/game.cpp @@ -83,8 +83,10 @@ DetectedGameList Engine_SAGA_detectGames(const FSList &fslist) { return Saga::GAME_detectGames(fslist); } -Engine *Engine_SAGA_create(OSystem *syst) { - return new Saga::SagaEngine(syst); +PluginError Engine_SAGA_create(OSystem *syst, Engine **engine) { + assert(engine); + *engine = new Saga::SagaEngine(syst); + return kNoError; } REGISTER_PLUGIN(SAGA, "SAGA Engine"); diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp index abeaae20e0..12d048d308 100644 --- a/engines/scumm/plugin.cpp +++ b/engines/scumm/plugin.cpp @@ -1278,8 +1278,9 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { * * This is heavily based on our MD5 detection scheme. */ -Engine *Engine_SCUMM_create(OSystem *syst) { - Engine *engine; +PluginError Engine_SCUMM_create(OSystem *syst, Engine **engine) { + assert(syst); + assert(engine); const char *gameid = ConfMan.get("gameid").c_str(); // We start by checking whether the specified game ID is obsolete. @@ -1313,8 +1314,8 @@ Engine *Engine_SCUMM_create(OSystem *syst) { // Unable to locate game data if (results.empty()) { - warning("ScummEngine: unable to locate game data"); - return new Engine_Empty(syst); + warning("ScummEngine: unable to locate game data at path '%s'", dir.path().c_str()); + return kNoGameDataFoundError; } DetectorResult res(*(results.begin())); @@ -1374,74 +1375,74 @@ Engine *Engine_SCUMM_create(OSystem *syst) { // instantiate the appropriate game engine. Hooray! switch (res.game.version) { case 0: - engine = new ScummEngine_c64(syst, res); + *engine = new ScummEngine_c64(syst, res); break; case 1: case 2: - engine = new ScummEngine_v2(syst, res); + *engine = new ScummEngine_v2(syst, res); break; case 3: if (res.game.features & GF_OLD_BUNDLE) - engine = new ScummEngine_v3old(syst, res); + *engine = new ScummEngine_v3old(syst, res); else - engine = new ScummEngine_v3(syst, res); + *engine = new ScummEngine_v3(syst, res); break; case 4: - engine = new ScummEngine_v4(syst, res); + *engine = new ScummEngine_v4(syst, res); break; case 5: - engine = new ScummEngine_v5(syst, res); + *engine = new ScummEngine_v5(syst, res); break; case 6: switch (res.game.heversion) { #ifndef DISABLE_HE case 100: - engine = new ScummEngine_v100he(syst, res); + *engine = new ScummEngine_v100he(syst, res); break; case 99: - engine = new ScummEngine_v99he(syst, res); + *engine = new ScummEngine_v99he(syst, res); break; case 98: case 95: case 90: - engine = new ScummEngine_v90he(syst, res); + *engine = new ScummEngine_v90he(syst, res); break; case 80: - engine = new ScummEngine_v80he(syst, res); + *engine = new ScummEngine_v80he(syst, res); break; case 73: case 72: - engine = new ScummEngine_v72he(syst, res); + *engine = new ScummEngine_v72he(syst, res); break; case 71: - engine = new ScummEngine_v71he(syst, res); + *engine = new ScummEngine_v71he(syst, res); break; case 70: - engine = new ScummEngine_v70he(syst, res); + *engine = new ScummEngine_v70he(syst, res); break; #endif #ifndef PALMOS_68K case 61: - engine = new ScummEngine_v60he(syst, res); + *engine = new ScummEngine_v60he(syst, res); break; #endif default: - engine = new ScummEngine_v6(syst, res); + *engine = new ScummEngine_v6(syst, res); } break; #ifndef DISABLE_SCUMM_7_8 case 7: - engine = new ScummEngine_v7(syst, res); + *engine = new ScummEngine_v7(syst, res); break; case 8: - engine = new ScummEngine_v8(syst, res); + *engine = new ScummEngine_v8(syst, res); break; #endif default: error("Engine_SCUMM_create(): Unknown version of game engine"); } - return engine; + return kNoError; } REGISTER_PLUGIN(SCUMM, "Scumm Engine"); diff --git a/engines/simon/game.cpp b/engines/simon/game.cpp index 34a135ef90..1685fd35b2 100644 --- a/engines/simon/game.cpp +++ b/engines/simon/game.cpp @@ -111,7 +111,7 @@ DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) { return Simon::GAME_detectGames(fslist); } -Engine *Engine_SIMON_create(OSystem *syst) { +PluginError Engine_SIMON_create(OSystem *syst, Engine **engine) { const char *gameid = ConfMan.get("gameid").c_str(); for (const ObsoleteGameID *o = obsoleteGameIDsTable; o->from; ++o) { @@ -129,7 +129,9 @@ Engine *Engine_SIMON_create(OSystem *syst) { } } - return new Simon::SimonEngine(syst); + assert(engine); + *engine = new Simon::SimonEngine(syst); + return kNoError; } REGISTER_PLUGIN(SIMON, "Simon the Sorcerer"); diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index f3b286a5ea..941f9df017 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -110,8 +110,10 @@ DetectedGameList Engine_SKY_detectGames(const FSList &fslist) { return detectedGames; } -Engine *Engine_SKY_create(OSystem *syst) { - return new Sky::SkyEngine(syst); +PluginError Engine_SKY_create(OSystem *syst, Engine **engine) { + assert(engine); + *engine = new Sky::SkyEngine(syst); + return kNoError; } REGISTER_PLUGIN(SKY, "Beneath a Steel Sky"); diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index cba1e97bb8..fd49b0de06 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -117,8 +117,10 @@ DetectedGameList Engine_SWORD1_detectGames(const FSList &fslist) { return detectedGames; } -Engine *Engine_SWORD1_create(OSystem *syst) { - return new SwordEngine(syst); +PluginError Engine_SWORD1_create(OSystem *syst, Engine **engine) { + assert(engine); + *engine = new SwordEngine(syst); + return kNoError; } REGISTER_PLUGIN(SWORD1, "Broken Sword"); diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 13e97dc0d8..fdbcbb5c07 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -111,8 +111,10 @@ DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) { return detectedGames; } -Engine *Engine_SWORD2_create(OSystem *syst) { - return new Sword2::Sword2Engine(syst); +PluginError Engine_SWORD2_create(OSystem *syst, Engine **engine) { + assert(engine); + *engine = new Sword2::Sword2Engine(syst); + return kNoError; } REGISTER_PLUGIN(SWORD2, "Broken Sword 2"); |