Skip to content

Commit

Permalink
WINTERMUTE: Introduce WMEGameDescription
Browse files Browse the repository at this point in the history
I aped what has been done with AGS: in engines/agi/detection.cpp, adding
a struct that includes ADGameDescription at the beginning.

This is also recommended in advancedDetector.h
  • Loading branch information
tobiatesan authored and somaen committed Nov 4, 2014
1 parent 028238e commit dfe465e
Show file tree
Hide file tree
Showing 7 changed files with 1,647 additions and 1,234 deletions.
3 changes: 2 additions & 1 deletion engines/wintermute/base/base_engine.cpp
Expand Up @@ -61,10 +61,11 @@ BaseEngine::~BaseEngine() {
delete _classReg;
}

void BaseEngine::createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang) {
void BaseEngine::createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang, WMETargetExecutable targetExecutable) {
instance()._targetName = targetName;
instance()._gameId = gameId;
instance()._language = lang;
instance()._targetExecutable = targetExecutable;
instance().init();
}

Expand Down
9 changes: 8 additions & 1 deletion engines/wintermute/base/base_engine.h
Expand Up @@ -34,6 +34,8 @@
#include "common/random.h"
#include "common/language.h"

#include "engines/wintermute/game_description.h"

namespace Wintermute {

class BaseFileManager;
Expand All @@ -53,10 +55,12 @@ class BaseEngine : public Common::Singleton<Wintermute::BaseEngine> {
Common::RandomSource *_rnd;
SystemClassRegistry *_classReg;
Common::Language _language;
WMETargetExecutable _targetExecutable;
public:
BaseEngine();
~BaseEngine();
static void createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang);
static void createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang, WMETargetExecutable targetExecutable = LATEST_VERSION);

void setGameRef(BaseGame *gameRef) { _gameRef = gameRef; }

Common::RandomSource *getRandomSource() { return _rnd; }
Expand All @@ -73,6 +77,9 @@ class BaseEngine : public Common::Singleton<Wintermute::BaseEngine> {
const char *getGameTargetName() const { return _targetName.c_str(); }
Common::String getGameId() const { return _gameId; }
Common::Language getLanguage() const { return _language; }
WMETargetExecutable getTargetExecutable() const {
return _targetExecutable;
}
};

} // End of namespace Wintermute
Expand Down
6 changes: 3 additions & 3 deletions engines/wintermute/detection.cpp
Expand Up @@ -74,7 +74,7 @@ static const char *directoryGlobs[] = {

class WintermuteMetaEngine : public AdvancedMetaEngine {
public:
WintermuteMetaEngine() : AdvancedMetaEngine(Wintermute::gameDescriptions, sizeof(ADGameDescription), Wintermute::wintermuteGames, gameGuiOptions) {
WintermuteMetaEngine() : AdvancedMetaEngine(Wintermute::gameDescriptions, sizeof(WMEGameDescription), Wintermute::wintermuteGames, gameGuiOptions) {
_singleid = "wintermute";
_guioptions = GUIO2(GUIO_NOMIDI, GAMEOPTION_SHOW_FPS);
_maxScanDepth = 2;
Expand Down Expand Up @@ -127,8 +127,8 @@ class WintermuteMetaEngine : public AdvancedMetaEngine {
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
assert(syst);
assert(engine);

*engine = new Wintermute::WintermuteEngine(syst, desc);
const WMEGameDescription *gd = (const WMEGameDescription *)desc;
*engine = new Wintermute::WintermuteEngine(syst, gd);
return true;
}

Expand Down

0 comments on commit dfe465e

Please sign in to comment.