aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2019-07-03 21:16:36 +0200
committerEugene Sandulenko2019-09-03 17:17:10 +0200
commit7e07602c25a42c0584cce2a98b47140cfa7ffc94 (patch)
tree7220871848945f1a7de96ab4c1e0e8b61b17d150 /engines
parent595187da81778b6dd3fdceb0155bd48fad99ea57 (diff)
downloadscummvm-rg350-7e07602c25a42c0584cce2a98b47140cfa7ffc94.tar.gz
scummvm-rg350-7e07602c25a42c0584cce2a98b47140cfa7ffc94.tar.bz2
scummvm-rg350-7e07602c25a42c0584cce2a98b47140cfa7ffc94.zip
HDB: Fix trigger launching
Diffstat (limited to 'engines')
-rw-r--r--engines/hdb/ai-lists.cpp2
-rw-r--r--engines/hdb/lua-script.cpp5
2 files changed, 6 insertions, 1 deletions
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) {