aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-04-16 07:37:49 -0400
committerPaul Gilbert2018-04-16 07:37:49 -0400
commitc92561cd614616924d5c82b6d8d5a0ac7fff215a (patch)
treefc6e2d56acf55a276ca40c50ec922a74918bf76d
parent77c06fe487b3735134f78db3e19be038410e1951 (diff)
downloadscummvm-rg350-c92561cd614616924d5c82b6d8d5a0ac7fff215a.tar.gz
scummvm-rg350-c92561cd614616924d5c82b6d8d5a0ac7fff215a.tar.bz2
scummvm-rg350-c92561cd614616924d5c82b6d8d5a0ac7fff215a.zip
XEEN: Fix Swords scripts using cmdReturn instead of cmdExit
-rw-r--r--engines/xeen/scripts.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index dfd5c210d6..81ba0caab9 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -1048,11 +1048,16 @@ bool Scripts::cmdCallEvent(ParamsIterator &params) {
}
bool Scripts::cmdReturn(ParamsIterator &params) {
- StackEntry se = _stack.pop();
- _currentPos = se;
- _lineNum = se.line;
+ if (_stack.empty()) {
+ // WORKAROUND: Some scripts in Swords of Xeen use cmdReturn as a substitute for cmdExit
+ return cmdExit(params);
+ } else {
+ StackEntry se = _stack.pop();
+ _currentPos = se;
+ _lineNum = se.line;
- return true;
+ return true;
+ }
}
bool Scripts::cmdSetVar(ParamsIterator &params) {