From 7e07602c25a42c0584cce2a98b47140cfa7ffc94 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 3 Jul 2019 21:16:36 +0200 Subject: HDB: Fix trigger launching --- engines/hdb/ai-lists.cpp | 2 ++ engines/hdb/lua-script.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/hdb/ai-lists.cpp b/engines/hdb/ai-lists.cpp index d2ddd4ae3a..d6534cc6cf 100644 --- a/engines/hdb/ai-lists.cpp +++ b/engines/hdb/ai-lists.cpp @@ -816,6 +816,8 @@ ArrowPath *AI::findArrowPath(int x, int y) { void AI::addToTriggerList(char *luaFuncInit, char *luaFuncUse, int x, int y, int value1, int value2, char *id) { Trigger *t = new Trigger; + _triggerList->push_back(t); + strcpy(t->id, id); t->x = x; t->y = y; diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index 02bf16ca50..bffb7856d2 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -1494,7 +1494,10 @@ void LuaScript::call(int args, int returns) { if (!_systemInit) return; - lua_call(_state, args, returns); + if (lua_pcall(_state, args, returns, -2)) { + error("An error occured while executing: %s.", lua_tostring(_state, -1)); + lua_pop(_state, -1); + } } bool LuaScript::callFunction(const char *name, int returns) { -- cgit v1.2.3