aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-29 02:59:14 +0200
committerEinar Johan Trøan Sømåen2012-07-29 03:41:07 +0200
commit482a5fb467e6694fb54c75f718563992657edf97 (patch)
tree6a88e4cc022c62276e53f3dceb8bbc7c5dabe18f
parent9b5cf8f1bafd5aa0dba9194a8f04e58724652891 (diff)
downloadscummvm-rg350-482a5fb467e6694fb54c75f718563992657edf97.tar.gz
scummvm-rg350-482a5fb467e6694fb54c75f718563992657edf97.tar.bz2
scummvm-rg350-482a5fb467e6694fb54c75f718563992657edf97.zip
WINTERMUTE: Make the BaseEngine-singleton use Common::Singleton as super-class
-rw-r--r--engines/wintermute/base/base_engine.cpp47
-rw-r--r--engines/wintermute/base/base_engine.h9
-rw-r--r--engines/wintermute/base/base_file_manager.cpp15
-rw-r--r--engines/wintermute/base/base_game.cpp22
-rw-r--r--engines/wintermute/base/base_parser.cpp2
-rw-r--r--engines/wintermute/base/base_persistence_manager.cpp9
-rw-r--r--engines/wintermute/base/base_persistence_manager.h3
-rw-r--r--engines/wintermute/base/base_registry.cpp4
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp6
-rw-r--r--engines/wintermute/base/scriptables/script_engine.cpp11
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.cpp4
-rw-r--r--engines/wintermute/detection.cpp6
-rw-r--r--engines/wintermute/wintermute.cpp11
13 files changed, 63 insertions, 86 deletions
diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp
index cd6e9c9e3b..0185d973fa 100644
--- a/engines/wintermute/base/base_engine.cpp
+++ b/engines/wintermute/base/base_engine.cpp
@@ -32,24 +32,17 @@
#include "engines/wintermute/base/base_engine.h"
#include "engines/wintermute/wintermute.h"
#include "common/system.h"
+namespace Common {
+DECLARE_SINGLETON(WinterMute::BaseEngine);
+}
namespace WinterMute {
-BaseEngine *BaseEngine::_instance = 0;
- /*
-class BaseEngine {
- static BaseEngine *_instance;
- BaseEngine();
- BaseFileManager *_fileManager;
- BaseRegistry *_registry;
-public:
- ~BaseEngine();
- BaseEngine *getInstance();
- BaseFileManager *getFileMan() { return _fileManager; }
- BaseRegistry *getRegistry() { return _registry; }
-};*/
BaseEngine::BaseEngine() {
-
+ _fileManager = NULL;
+ _registry = NULL;
+ _gameRef = NULL;
+ _gameId = "";
}
void BaseEngine::init() {
@@ -63,25 +56,9 @@ BaseEngine::~BaseEngine() {
delete _registry;
}
-BaseEngine *BaseEngine::getInstance() {
- if (!_instance)
- assert(0);
- return _instance;
-}
-
void BaseEngine::createInstance(const Common::String &gameid) {
- if (_instance) {
- delete _instance;
- _instance = NULL;
- }
- _instance = new BaseEngine();
- _instance->_gameId = gameid;
- _instance->init();
-}
-
-void BaseEngine::destroyInstance() {
- delete _instance;
- _instance = NULL;
+ instance()._gameId = gameid;
+ instance().init();
}
void BaseEngine::LOG(bool res, const char *fmt, ...) {
@@ -98,11 +75,11 @@ void BaseEngine::LOG(bool res, const char *fmt, ...) {
vsprintf(buff, fmt, va);
va_end(va);
- if (_instance && _instance->_gameRef) {
- _instance->_gameRef->LOG("%s", buff);
+ if (instance()._gameRef) {
+ instance()._gameRef->LOG("%s", buff);
} else {
debugCN(kWinterMuteDebugLog, "%02d:%02d:%02d: %s\n", hours, mins, secs, buff);
}
}
-} // end of namespace WinterMute \ No newline at end of file
+} // end of namespace WinterMute
diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h
index 5782c012d8..d45d979f25 100644
--- a/engines/wintermute/base/base_engine.h
+++ b/engines/wintermute/base/base_engine.h
@@ -27,26 +27,23 @@
*/
#include "common/str.h"
+ #include "common/singleton.h"
namespace WinterMute {
class BaseFileManager;
class BaseRegistry;
class BaseGame;
-class BaseEngine {
- static BaseEngine *_instance;
- BaseEngine();
+class BaseEngine : public Common::Singleton<WinterMute::BaseEngine> {
void init();
BaseFileManager *_fileManager;
BaseRegistry *_registry;
Common::String _gameId;
BaseGame *_gameRef;
public:
+ BaseEngine();
~BaseEngine();
static void createInstance(const Common::String &gameid);
- static BaseEngine *getInstance();
- static void destroyInstance();
-
void setGameRef(BaseGame *gameRef) { _gameRef = gameRef; }
BaseGame *getGameRef() { return _gameRef; }
diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp
index 83047ca75c..801729c5e8 100644
--- a/engines/wintermute/base/base_file_manager.cpp
+++ b/engines/wintermute/base/base_file_manager.cpp
@@ -147,15 +147,14 @@ bool BaseFileManager::reloadPaths() {
//////////////////////////////////////////////////////////////////////////
bool BaseFileManager::initPaths() {
- BaseEngine *enginePtr = BaseEngine::getInstance();
- if (!enginePtr) { // This function only works when the game-registry is loaded
+ if (!BaseEngine::instance().getRegistry()) { // This function only works when the game-registry is loaded
return STATUS_FAILED;
}
AnsiString pathList;
// single files paths
- pathList = enginePtr->getRegistry()->readString("Resource", "CustomPaths", "");
+ pathList = BaseEngine::instance().getRegistry()->readString("Resource", "CustomPaths", "");
Common::StringTokenizer *entries = new Common::StringTokenizer(pathList, ";");
// numPaths = BaseUtils::strNumEntries(pathList.c_str(), ';');
while (!entries->empty()) {
@@ -172,7 +171,7 @@ bool BaseFileManager::initPaths() {
const Common::FSNode gameData(ConfMan.get("path"));
addPath(PATH_PACKAGE, gameData);
- pathList = enginePtr->getRegistry()->readString("Resource", "PackagePaths", "");
+ pathList = BaseEngine::instance().getRegistry()->readString("Resource", "PackagePaths", "");
entries = new Common::StringTokenizer(pathList, ";");
while (!entries->empty()) {
Common::String path = entries->nextToken();
@@ -271,7 +270,7 @@ Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &f
bool BaseFileManager::hasFile(const Common::String &filename) {
if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) {
- BasePersistenceManager pm(BaseEngine::getInstance()->getGameId());
+ BasePersistenceManager pm(BaseEngine::instance().getGameId());
if (filename.size() <= 9) {
return false;
}
@@ -323,7 +322,7 @@ Common::SeekableReadStream *BaseFileManager::openFileRaw(const Common::String &f
Common::SeekableReadStream *ret = NULL;
if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) {
- if (!BaseEngine::getInstance()) {
+ if (!BaseEngine::instance().getGameRef()) {
error("Attempt to load filename: %s without BaseEngine-object, this is unsupported", filename.c_str());
}
BaseSaveThumbFile *saveThumbFile = new BaseSaveThumbFile();
@@ -354,8 +353,8 @@ Common::SeekableReadStream *BaseFileManager::openFileRaw(const Common::String &f
}
BaseFileManager *BaseFileManager::getEngineInstance() {
- if (BaseEngine::getInstance()) {
- return BaseEngine::getInstance()->getFileManager();
+ if (BaseEngine::instance().getFileManager()) {
+ return BaseEngine::instance().getFileManager();
}
return NULL;
}
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 687e394920..6fea190e01 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -279,7 +279,7 @@ BaseGame::~BaseGame() {
getDebugMgr()->onGameShutdown();
- BaseEngine::getInstance()->getRegistry()->writeBool("System", "LastRun", true);
+ BaseEngine::instance().getRegistry()->writeBool("System", "LastRun", true);
cleanup();
@@ -1549,7 +1549,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
stack->correctParams(2);
const char *key = stack->pop()->getString();
int val = stack->pop()->getInt();
- BaseEngine::getInstance()->getRegistry()->writeInt("PrivateSettings", key, val);
+ BaseEngine::instance().getRegistry()->writeInt("PrivateSettings", key, val);
stack->pushNULL();
return STATUS_OK;
}
@@ -1561,7 +1561,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
stack->correctParams(2);
const char *key = stack->pop()->getString();
int initVal = stack->pop()->getInt();
- stack->pushInt(BaseEngine::getInstance()->getRegistry()->readInt("PrivateSettings", key, initVal));
+ stack->pushInt(BaseEngine::instance().getRegistry()->readInt("PrivateSettings", key, initVal));
return STATUS_OK;
}
@@ -1572,7 +1572,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
stack->correctParams(2);
const char *key = stack->pop()->getString();
const char *val = stack->pop()->getString();
- BaseEngine::getInstance()->getRegistry()->writeString("PrivateSettings", key, val);
+ BaseEngine::instance().getRegistry()->writeString("PrivateSettings", key, val);
stack->pushNULL();
return STATUS_OK;
}
@@ -1584,7 +1584,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
stack->correctParams(2);
const char *key = stack->pop()->getString();
const char *initVal = stack->pop()->getString();
- AnsiString val = BaseEngine::getInstance()->getRegistry()->readString("PrivateSettings", key, initVal);
+ AnsiString val = BaseEngine::instance().getRegistry()->readString("PrivateSettings", key, initVal);
stack->pushString(val.c_str());
return STATUS_OK;
}
@@ -2642,7 +2642,7 @@ ScValue *BaseGame::scGetProperty(const char *name) {
// MostRecentSaveSlot (RO)
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MostRecentSaveSlot") == 0) {
- _scValue->setInt(BaseEngine::getInstance()->getRegistry()->readInt("System", "MostRecentSaveSlot", -1));
+ _scValue->setInt(BaseEngine::instance().getRegistry()->readInt("System", "MostRecentSaveSlot", -1));
return _scValue;
}
@@ -3349,7 +3349,7 @@ bool BaseGame::saveGame(int slot, const char *desc, bool quickSave) {
if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->saveTable(_gameRef, pm, quickSave))) {
if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->saveInstances(_gameRef, pm, quickSave))) {
if (DID_SUCCEED(ret = pm->saveFile(filename))) {
- BaseEngine::getInstance()->getRegistry()->writeInt("System", "MostRecentSaveSlot", slot);
+ BaseEngine::instance().getRegistry()->writeInt("System", "MostRecentSaveSlot", slot);
}
}
}
@@ -3688,7 +3688,7 @@ bool BaseGame::loadSettings(const char *filename) {
break;
case TOKEN_REGISTRY_PATH:
- BaseEngine::getInstance()->getRegistry()->setBasePath((char *)params);
+ BaseEngine::instance().getRegistry()->setBasePath((char *)params);
break;
case TOKEN_RICH_SAVED_GAMES:
@@ -3712,8 +3712,8 @@ bool BaseGame::loadSettings(const char *filename) {
ret = STATUS_FAILED;
}
- _settingsAllowWindowed = BaseEngine::getInstance()->getRegistry()->readBool("Debug", "AllowWindowed", _settingsAllowWindowed);
- _compressedSavegames = BaseEngine::getInstance()->getRegistry()->readBool("Debug", "CompressedSavegames", _compressedSavegames);
+ _settingsAllowWindowed = BaseEngine::instance().getRegistry()->readBool("Debug", "AllowWindowed", _settingsAllowWindowed);
+ _compressedSavegames = BaseEngine::instance().getRegistry()->readBool("Debug", "CompressedSavegames", _compressedSavegames);
//_compressedSavegames = false;
delete[] origBuffer;
@@ -4713,7 +4713,7 @@ bool BaseGame::isDoubleClick(int buttonIndex) {
//////////////////////////////////////////////////////////////////////////
void BaseGame::autoSaveOnExit() {
_soundMgr->saveSettings();
- BaseEngine::getInstance()->getRegistry()->saveValues();
+ BaseEngine::instance().getRegistry()->saveValues();
if (!_autoSaveOnExit) {
return;
diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp
index 5dba8f9317..5d5a2d534d 100644
--- a/engines/wintermute/base/base_parser.cpp
+++ b/engines/wintermute/base/base_parser.cpp
@@ -123,7 +123,7 @@ int32 BaseParser::getCommand(char **buf, TokenDesc *tokens, char **params) {
if (!*buf) {
return PARSERR_TOKENNOTFOUND;
}
- BaseEngine::getInstance()->getGameRef()->miniUpdate();
+ BaseEngine::instance().getGameRef()->miniUpdate();
char *name;
return getObject(buf, tokens, &name, params);
}
diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp
index 2d30395928..ddc5e15d92 100644
--- a/engines/wintermute/base/base_persistence_manager.cpp
+++ b/engines/wintermute/base/base_persistence_manager.cpp
@@ -53,15 +53,16 @@ namespace WinterMute {
#define SAVE_MAGIC_2 0x32564153
//////////////////////////////////////////////////////////////////////////
-BasePersistenceManager::BasePersistenceManager(const char *savePrefix) {
+BasePersistenceManager::BasePersistenceManager(const char *savePrefix, bool deleteSingleton) {
_saving = false;
// _buffer = NULL;
// _bufferSize = 0;
_offset = 0;
_saveStream = NULL;
_loadStream = NULL;
- if (BaseEngine::getInstance()) {
- _gameRef = BaseEngine::getInstance()->getGameRef();
+ _deleteSingleton = deleteSingleton;
+ if (BaseEngine::instance().getGameRef()) {
+ _gameRef = BaseEngine::instance().getGameRef();
} else {
_gameRef = NULL;
}
@@ -89,6 +90,8 @@ BasePersistenceManager::BasePersistenceManager(const char *savePrefix) {
//////////////////////////////////////////////////////////////////////////
BasePersistenceManager::~BasePersistenceManager() {
cleanup();
+ if (_deleteSingleton)
+ BaseEngine::destroy();
}
diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h
index 30fac6e191..87892b42f3 100644
--- a/engines/wintermute/base/base_persistence_manager.h
+++ b/engines/wintermute/base/base_persistence_manager.h
@@ -87,7 +87,7 @@ public:
bool transfer(const char *name, Common::String *val);
bool transfer(const char *name, Vector2 *val);
bool transfer(const char *name, AnsiStringArray &Val);
- BasePersistenceManager(const char *savePrefix = NULL);
+ BasePersistenceManager(const char *savePrefix = NULL, bool deleteSingleton = false);
virtual ~BasePersistenceManager();
bool checkVersion(byte verMajor, byte verMinor, byte verBuild);
@@ -95,6 +95,7 @@ public:
byte *_thumbnailData;
Common::String getFilenameForSlot(int slot) const;
private:
+ bool _deleteSingleton;
bool readHeader(const Common::String &filename);
TimeDate getTimeDate();
bool putTimeDate(const TimeDate &t);
diff --git a/engines/wintermute/base/base_registry.cpp b/engines/wintermute/base/base_registry.cpp
index 495f68b486..d03691ea42 100644
--- a/engines/wintermute/base/base_registry.cpp
+++ b/engines/wintermute/base/base_registry.cpp
@@ -175,13 +175,13 @@ char *BaseRegistry::getIniName() {
//////////////////////////////////////////////////////////////////////////
void BaseRegistry::loadValues(bool local) {
- Common::String filename = Common::String(BaseEngine::getInstance()->getGameId()) + "-settings.xml";
+ Common::String filename = Common::String(BaseEngine::instance().getGameId()) + "-settings.xml";
loadXml(filename, _values);
}
//////////////////////////////////////////////////////////////////////////
void BaseRegistry::saveValues() {
- Common::String filename = Common::String(BaseEngine::getInstance()->getGameId()) + "-settings.xml";
+ Common::String filename = Common::String(BaseEngine::instance().getGameId()) + "-settings.xml";
saveXml(filename, _values);
}
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index 51b0c2dd36..6e18aaba29 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -127,8 +127,8 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) {
//TODO: Tiny resolution-displays might want to do some resolution-selection logic here
- _realWidth = BaseEngine::getInstance()->getRegistry()->readInt("Debug", "ForceResWidth", _width);
- _realHeight = BaseEngine::getInstance()->getRegistry()->readInt("Debug", "ForceResHeight", _height);
+ _realWidth = BaseEngine::instance().getRegistry()->readInt("Debug", "ForceResWidth", _width);
+ _realHeight = BaseEngine::instance().getRegistry()->readInt("Debug", "ForceResHeight", _height);
float origAspect = (float)_width / (float)_height;
float realAspect = (float)_realWidth / (float)_realHeight;
@@ -153,7 +153,7 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) {
_ratioX = (float)(_realWidth - _borderLeft - _borderRight) / (float)_width;
_ratioY = (float)(_realHeight - _borderTop - _borderBottom) / (float)_height;
- //_windowed = BaseEngine::getInstance()->getRegistry()->readBool("Video", "Windowed", true); TODO
+ //_windowed = BaseEngine::instance().getRegistry()->readBool("Video", "Windowed", true); TODO
Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
g_system->beginGFXTransaction();
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
index 9e11a7c5b4..96250dbb90 100644
--- a/engines/wintermute/base/scriptables/script_engine.cpp
+++ b/engines/wintermute/base/scriptables/script_engine.cpp
@@ -128,7 +128,6 @@ bool ScEngine::cleanup() {
//////////////////////////////////////////////////////////////////////////
byte *ScEngine::loadFile(void *data, char *filename, uint32 *size) {
- BaseGame *gameRef = (BaseGame *)data;
return BaseFileManager::getEngineInstance()->readWholeFile(filename, size);
}
@@ -201,7 +200,7 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig
uint32 size;
- byte *buffer = BaseEngine::getInstance()->getFileManager()->readWholeFile(filename, &size);
+ byte *buffer = BaseEngine::instance().getFileManager()->readWholeFile(filename, &size);
if (!buffer) {
_gameRef->LOG(0, "ScEngine::GetCompiledScript - error opening script '%s'", filename);
return NULL;
@@ -690,10 +689,10 @@ bool ScEngine::saveBreakpoints() {
sprintf(key, "Breakpoint%d", count);
sprintf(text, "%s:%d", _breakpoints[i]->_filename.c_str(), _breakpoints[i]->_lines[j]);
- BaseEngine::getInstance()->getRegistry()->writeString("Debug", key, text);
+ BaseEngine::instance().getRegistry()->writeString("Debug", key, text);
}
}
- BaseEngine::getInstance()->getRegistry()->writeInt("Debug", "NumBreakpoints", count);
+ BaseEngine::instance().getRegistry()->writeInt("Debug", "NumBreakpoints", count);
return STATUS_OK;
}
@@ -706,11 +705,11 @@ bool ScEngine::loadBreakpoints() {
char key[100];
- int count = BaseEngine::getInstance()->getRegistry()->readInt("Debug", "NumBreakpoints", 0);
+ int count = BaseEngine::instance().getRegistry()->readInt("Debug", "NumBreakpoints", 0);
for (int i = 1; i <= count; i++) {
/* uint32 bufSize = 512; */
sprintf(key, "Breakpoint%d", i);
- AnsiString breakpoint = BaseEngine::getInstance()->getRegistry()->readString("Debug", key, "");
+ AnsiString breakpoint = BaseEngine::instance().getRegistry()->readString("Debug", key, "");
char *path = BaseUtils::strEntry(0, breakpoint.c_str(), ':');
char *line = BaseUtils::strEntry(1, breakpoint.c_str(), ':');
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
index 61c7376c79..03f6fffb58 100644
--- a/engines/wintermute/base/sound/base_sound_manager.cpp
+++ b/engines/wintermute/base/sound/base_sound_manager.cpp
@@ -72,7 +72,7 @@ bool BaseSoundMgr::cleanup() {
//////////////////////////////////////////////////////////////////////////
void BaseSoundMgr::saveSettings() {
if (_soundAvailable) {
- BaseEngine::getInstance()->getRegistry()->writeInt("Audio", "MasterVolume", _volumeMaster);
+ BaseEngine::instance().getRegistry()->writeInt("Audio", "MasterVolume", _volumeMaster);
}
}
@@ -83,7 +83,7 @@ bool BaseSoundMgr::initialize() {
if (!g_system->getMixer()->isReady()) {
return STATUS_FAILED;
}
- _volumeMaster = BaseEngine::getInstance()->getRegistry()->readInt("Audio", "MasterVolume", 255);
+ _volumeMaster = BaseEngine::instance().getRegistry()->readInt("Audio", "MasterVolume", 255);
_soundAvailable = true;
return STATUS_OK;
diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp
index 269ab28601..af2560fcf2 100644
--- a/engines/wintermute/detection.cpp
+++ b/engines/wintermute/detection.cpp
@@ -169,7 +169,7 @@ public:
SaveStateList listSaves(const char *target) const {
SaveStateList saves;
- WinterMute::BasePersistenceManager pm(target);
+ WinterMute::BasePersistenceManager pm(target, true);
for (int i = 0; i < getMaximumSaveSlot(); i++) {
if (pm.getSaveExists(i)) {
SaveStateDescriptor desc;
@@ -185,12 +185,12 @@ public:
}
void removeSaveState(const char *target, int slot) const {
- WinterMute::BasePersistenceManager pm(target);
+ WinterMute::BasePersistenceManager pm(target, true);
pm.deleteSaveSlot(slot);
}
virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const {
- WinterMute::BasePersistenceManager pm(target);
+ WinterMute::BasePersistenceManager pm(target, true);
SaveStateDescriptor retVal;
retVal.setDescription("Invalid savegame");
pm.getSaveStateDesc(slot, retVal);
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
index f2e811b45e..8e07569bf7 100644
--- a/engines/wintermute/wintermute.cpp
+++ b/engines/wintermute/wintermute.cpp
@@ -161,7 +161,7 @@ int WinterMuteEngine::init() {
BaseEngine::createInstance(_targetName);
_game = new AdGame(_targetName);
if (!_game) return 1;
- BaseEngine::getInstance()->setGameRef(_game);
+ BaseEngine::instance().setGameRef(_game);
BasePlatform::initialize(_game, 0, NULL);
bool windowedMode = !ConfMan.getBool("fullscreen");
@@ -194,11 +194,11 @@ int WinterMuteEngine::init() {
}*/
- if (BaseEngine::getInstance()->getRegistry()->readBool("Debug", "DebugMode")) _game->DEBUG_DebugEnable("./wme.log");
+ if (BaseEngine::instance().getRegistry()->readBool("Debug", "DebugMode")) _game->DEBUG_DebugEnable("./wme.log");
- _game->_debugShowFPS = BaseEngine::getInstance()->getRegistry()->readBool("Debug", "ShowFPS");
+ _game->_debugShowFPS = BaseEngine::instance().getRegistry()->readBool("Debug", "ShowFPS");
- if (BaseEngine::getInstance()->getRegistry()->readBool("Debug", "DisableSmartCache")) {
+ if (BaseEngine::instance().getRegistry()->readBool("Debug", "DisableSmartCache")) {
_game->LOG(0, "Smart cache is DISABLED");
_game->_smartCache = false;
}
@@ -337,7 +337,7 @@ int WinterMuteEngine::messageLoop() {
void WinterMuteEngine::deinit() {
delete _classReg;
_classReg = NULL;
- BaseEngine::destroyInstance();
+ BaseEngine::destroy();
}
bool WinterMuteEngine::getGameInfo(const Common::FSList &fslist, Common::String &name, Common::String &caption) {
@@ -418,6 +418,7 @@ bool WinterMuteEngine::getGameInfo(const Common::FSList &fslist, Common::String
delete stream;
}
delete fileMan;
+ BaseEngine::destroy();
return retVal;
}