MACVENTURE: Add conditionals to engine destructors

This commit is contained in:
Borja Lorente 2016-08-07 17:33:36 +02:00
parent 8608776768
commit dd35275176
2 changed files with 21 additions and 7 deletions

View File

@ -31,8 +31,7 @@ enum MacVentureDebugChannel {
kMVDebugText = 1 << 3,
kMVDebugScript = 1 << 4,
kMVDebugSound = 1 << 5,
kMVDebugContainer = 1 << 6,
kMVDebugTests = 1 << 31
kMVDebugContainer = 1 << 6
};
} // End namespace MacVenture

View File

@ -56,9 +56,17 @@ MacVentureEngine::MacVentureEngine(OSystem *syst, const ADGameDescription *gameD
_debugger = NULL;
_gui = NULL;
_scriptEngine = NULL;
_filenames = NULL;
_decodingDirectArticles = NULL;
_decodingNamingArticles = NULL;
_decodingIndirectArticles = NULL;
_textHuffman = NULL;
_soundManager = NULL;
_dataBundle = NULL;
debug("MacVenture::MacVentureEngine()");
}
@ -67,10 +75,18 @@ MacVentureEngine::~MacVentureEngine() {
debug("MacVenture::~MacVentureEngine()");
DebugMan.clearAllDebugChannels();
delete _rnd;
delete _debugger;
delete _gui;
delete _scriptEngine;
if (_rnd)
delete _rnd;
if (_debugger)
delete _debugger;
if (_gui)
delete _gui;
if (_scriptEngine)
delete _scriptEngine;
if (_filenames)
delete _filenames;
@ -106,7 +122,6 @@ void MacVentureEngine::initDebugChannels() {
Common::Error MacVentureEngine::run() {
debug("MacVenture::MacVentureEngine::init()");
initGraphics(kScreenWidth, kScreenHeight, true);
_debugger = new Console(this);