aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2010-11-30 14:45:31 +0000
committerMatthew Hoops2010-11-30 14:45:31 +0000
commitc6a9cef9fb36fd6a0697f86fd59acc279d8b67a8 (patch)
tree86623074062d602b342d303bb75730f9e700a53a /engines
parent868e39c29a269034a00c7997e1f491231b10b8ce (diff)
downloadscummvm-rg350-c6a9cef9fb36fd6a0697f86fd59acc279d8b67a8.tar.gz
scummvm-rg350-c6a9cef9fb36fd6a0697f86fd59acc279d8b67a8.tar.bz2
scummvm-rg350-c6a9cef9fb36fd6a0697f86fd59acc279d8b67a8.zip
MOHAWK: Fix changing the stack via an opcode
svn-id: r54676
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/myst.cpp9
-rw-r--r--engines/mohawk/myst.h1
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);