From c92561cd614616924d5c82b6d8d5a0ac7fff215a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 16 Apr 2018 07:37:49 -0400 Subject: XEEN: Fix Swords scripts using cmdReturn instead of cmdExit --- engines/xeen/scripts.cpp | 13 +++++++++---- 1 file 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 ¶ms) { } bool Scripts::cmdReturn(ParamsIterator ¶ms) { - 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 ¶ms) { -- cgit v1.2.3