From c640d1c604f219a5be5412d6c5ea8a85f44ec4b4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 3 Nov 2007 21:06:58 +0000 Subject: Patch #1825276: "DETECTION: advanced detector engine simplification" svn-id: r29386 --- engines/saga/detection.cpp | 16 +++++++++------- engines/saga/saga.cpp | 4 ++-- engines/saga/saga.h | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'engines/saga') diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index 2ca1ae4482..95a2cd297d 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -139,19 +139,21 @@ static const Common::ADParams detectionParams = { Common::kADFlagAugmentPreferredTarget }; -ADVANCED_DETECTOR_DEFINE_PLUGIN(SAGA, Saga::SagaEngine, detectionParams); +static bool Engine_SAGA_createInstance(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) { + const Saga::SAGAGameDescription *gd = (const Saga::SAGAGameDescription *)(encapsulatedDesc.realDesc); + if (gd) { + *engine = new Saga::SagaEngine(syst, gd); + } + return gd != 0; +} + +ADVANCED_DETECTOR_DEFINE_PLUGIN(SAGA, Engine_SAGA_createInstance, detectionParams); REGISTER_PLUGIN(SAGA, "SAGA Engine", "Inherit the Earth (C) Wyrmkeep Entertainment"); namespace Saga { bool SagaEngine::initGame() { - Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams); - _gameDescription = (const SAGAGameDescription *)(encapsulatedDesc.realDesc); - - if (_gameDescription == 0) - return false; - _displayClip.right = getDisplayInfo().logicalWidth; _displayClip.bottom = getDisplayInfo().logicalHeight; diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 4cd0c1a381..2723551d94 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -59,8 +59,8 @@ namespace Saga { #define MAX_TIME_DELTA 100 -SagaEngine::SagaEngine(OSystem *syst) - : Engine(syst) { +SagaEngine::SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc) + : Engine(syst), _gameDescription(gameDesc) { _leftMouseButtonPressed = _rightMouseButtonPressed = false; diff --git a/engines/saga/saga.h b/engines/saga/saga.h index 0879d15a0d..cac2b911db 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -504,7 +504,7 @@ protected: int go(); int init(); public: - SagaEngine(OSystem *syst); + SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc); virtual ~SagaEngine(); void shutDown() { _quit = true; } -- cgit v1.2.3