aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/util
diff options
context:
space:
mode:
authorEugene Sandulenko2016-02-19 22:38:42 +0100
committerEugene Sandulenko2016-02-19 22:42:01 +0100
commit12fadf713d867653cd871fa1788358b63a29aee2 (patch)
tree64dc589fc09585b54373d1bf0ffba32160adf217 /engines/sword25/util
parent5b528a55827d3d5a95ac14d50063b24e14e1fdc0 (diff)
downloadscummvm-rg350-12fadf713d867653cd871fa1788358b63a29aee2.tar.gz
scummvm-rg350-12fadf713d867653cd871fa1788358b63a29aee2.tar.bz2
scummvm-rg350-12fadf713d867653cd871fa1788358b63a29aee2.zip
SWORD25: Fixing bug #7041: SWORD25: Crash in final scene
The original was ignoring Lua errors in that scene and was restoring the state with longjmp. We are yet to see the platform compatibility, but Lua's code is too tangled to make simple replacement with error() work. Another possible alternative would be to rework the original game scripts. We will do it if this commit is problematic.
Diffstat (limited to 'engines/sword25/util')
-rw-r--r--engines/sword25/util/lua/ldo.cpp5
-rw-r--r--engines/sword25/util/lua/luaconf.h2
2 files changed, 3 insertions, 4 deletions
diff --git a/engines/sword25/util/lua/ldo.cpp b/engines/sword25/util/lua/ldo.cpp
index d53f95adaa..f4139cb9fc 100644
--- a/engines/sword25/util/lua/ldo.cpp
+++ b/engines/sword25/util/lua/ldo.cpp
@@ -111,9 +111,8 @@ static const char* luaErrorDescription[] = {
void luaD_throw (lua_State *L, int errcode) {
if (L->errorJmp) {
L->errorJmp->status = errcode;
- // LUAI_THROW has been replaced with an error message in ScummVM, together
- // with the LUA error code and description
- //LUAI_THROW(L, L->errorJmp);
+ // LUAI_THROW is sometimes used to ignore the error and restore LUA state
+ LUAI_THROW(L, L->errorJmp);
error("LUA error occurred, error code is %d (%s)", errcode, luaErrorDescription[errcode]);
}
else {
diff --git a/engines/sword25/util/lua/luaconf.h b/engines/sword25/util/lua/luaconf.h
index fb85983998..53d0f55290 100644
--- a/engines/sword25/util/lua/luaconf.h
+++ b/engines/sword25/util/lua/luaconf.h
@@ -621,7 +621,7 @@ union luai_Cast { double l_d; long l_l; };
#else
/* default handling with long jumps */
-//#define LUAI_THROW(L,c) longjmp((c)->b, 1) // replaced with error() in ScummVM
+#define LUAI_THROW(L,c) longjmp((c)->b, 1)
#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
#define luai_jmpbuf jmp_buf