diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mohawk/myst.cpp | 9 | ||||
-rw-r--r-- | engines/mohawk/myst.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 6cab8f8eec..f141a5aa68 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -82,6 +82,8 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription _cursorHintCount = 0; _cursorHints = NULL; + _prevStack = NULL; + _view.conditionalImageCount = 0; _view.conditionalImages = NULL; _view.soundList = NULL; @@ -105,6 +107,7 @@ MohawkEngine_Myst::~MohawkEngine_Myst() { delete _saveLoad; delete _loadDialog; delete _optionsDialog; + delete _prevStack; delete[] _cursorHints; @@ -365,7 +368,11 @@ void MohawkEngine_Myst::changeToStack(uint16 stack) { _curStack = stack; - delete _scriptParser; + // Delete the previous stack and move the current stack to the previous one + // There's probably a better way to do this, but the script classes shouldn't + // take up much memory. + delete _prevStack; + _prevStack = _scriptParser; switch (_curStack) { case kSeleniticStack: diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index 0a2b0fbbbc..63b9c11ef4 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -196,6 +196,7 @@ private: MystConsole *_console; GUI::SaveLoadChooser *_loadDialog; MystOptionsDialog *_optionsDialog; + MystScriptParser *_prevStack; ResourceCache _cache; void cachePreload(uint32 tag, uint16 id); |