aboutsummaryrefslogtreecommitdiff
path: root/saga/sthread.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2005-06-13 13:40:28 +0000
committerEugene Sandulenko2005-06-13 13:40:28 +0000
commit4f2cfd5feba4ce07a94c151c740cc6ba785c3932 (patch)
tree175ccd38032ed63c43962297a2f8dcd11d67cffc /saga/sthread.cpp
parent1dbf319b59f7c76120b7956ac3f3381dbe26b0e3 (diff)
downloadscummvm-rg350-4f2cfd5feba4ce07a94c151c740cc6ba785c3932.tar.gz
scummvm-rg350-4f2cfd5feba4ce07a94c151c740cc6ba785c3932.tar.bz2
scummvm-rg350-4f2cfd5feba4ce07a94c151c740cc6ba785c3932.zip
Fix crash on chasm.
svn-id: r18383
Diffstat (limited to 'saga/sthread.cpp')
-rw-r--r--saga/sthread.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/saga/sthread.cpp b/saga/sthread.cpp
index 9b831506a8..42cba6bda6 100644
--- a/saga/sthread.cpp
+++ b/saga/sthread.cpp
@@ -194,6 +194,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
byte argumentsCount;
uint16 functionNumber;
+ uint16 checkStackTopIndex;
ScriptFunctionType scriptFunction;
int debug_print = 0;
@@ -342,8 +343,12 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
debug(8, "Calling 0x%X %s", functionNumber, _scriptFunctionsList[functionNumber].scriptFunctionName);
scriptFunction = _scriptFunctionsList[functionNumber].scriptFunction;
+ checkStackTopIndex = thread->_stackTopIndex + argumentsCount;
+
(this->*scriptFunction)(thread, argumentsCount);
+ thread->_stackTopIndex = checkStackTopIndex;
+
if (scriptFunction == &Saga::Script::sfScriptGotoScene) {
return true; // cause abortAllThreads called and _this_ thread destroyed
}