diff options
author | Nipun Garg | 2019-07-19 21:12:43 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:24 +0200 |
commit | 31ec40a91a16c501c39cbed8fd1d16cd042e4458 (patch) | |
tree | 000a9a85ba858e3f0fb0819b9a521f3d7da8c26e /engines/hdb | |
parent | 1b6b2a96a06d84cd8c2c162101ee94b221552413 (diff) | |
download | scummvm-rg350-31ec40a91a16c501c39cbed8fd1d16cd042e4458.tar.gz scummvm-rg350-31ec40a91a16c501c39cbed8fd1d16cd042e4458.tar.bz2 scummvm-rg350-31ec40a91a16c501c39cbed8fd1d16cd042e4458.zip |
HDB: Fix checkActionList()
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/ai-lists.cpp | 18 | ||||
-rw-r--r-- | engines/hdb/ai.h | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/engines/hdb/ai-lists.cpp b/engines/hdb/ai-lists.cpp index 2b122f4920..f3b087ecca 100644 --- a/engines/hdb/ai-lists.cpp +++ b/engines/hdb/ai-lists.cpp @@ -259,14 +259,14 @@ int AI::checkFairystones(int tileX, int tileY) { // Add an action location to the list of possible actions // Each action must be paired with another of the same number -void AI::addToActionList(int actionIndex, int x, int y, char *luaFuncInt, char *luaFuncUse) { +void AI::addToActionList(int actionIndex, int x, int y, char *luaFuncInit, char *luaFuncUse) { if (!_actions[actionIndex].x1) { _actions[actionIndex].x1 = x; _actions[actionIndex].y1 = y; - if (luaFuncInt[0] != '*') - strcpy(_actions[actionIndex].luaFuncInit, luaFuncInt); - if (luaFuncInt[0] != '*') + if (luaFuncInit[0] != '*') + strcpy(_actions[actionIndex].luaFuncInit, luaFuncInit); + if (luaFuncUse[0] != '*') strcpy(_actions[actionIndex].luaFuncUse, luaFuncUse); if (_actions[actionIndex].luaFuncInit[0]) { @@ -280,9 +280,9 @@ void AI::addToActionList(int actionIndex, int x, int y, char *luaFuncInt, char * if (!_actions[actionIndex].x2) { _actions[actionIndex].x2 = x; _actions[actionIndex].y2 = y; - if (luaFuncInt[0] != '*') - strcpy(_actions[actionIndex].luaFuncInit, luaFuncInt); - if (luaFuncInt[0] != '*') + if (luaFuncInit[0] != '*') + strcpy(_actions[actionIndex].luaFuncInit, luaFuncInit); + if (luaFuncUse[0] != '*') strcpy(_actions[actionIndex].luaFuncUse, luaFuncUse); if (_actions[actionIndex].luaFuncInit[0]) { @@ -328,8 +328,10 @@ bool AI::checkActionList(AIEntity *e, int x, int y, bool lookAndGrab) { _actions[i].x1 = _actions[i].y1 = _actions[i].x2 = _actions[i].y2 = 0; // Call Lua Use function if it exists - if (_actions[i].luaFuncUse[0]) + if (_actions[i].luaFuncUse[0]) { g_hdb->_lua->callFunction(_actions[i].luaFuncUse, 0); + } + } else if (e == _player && !checkForTouchplate(x, y)) addWaypoint(e->tileX, e->tileY, x, y, e->level); diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 83fe88b9ff..bb862220a2 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -881,7 +881,7 @@ public: bool checkActionList(AIEntity *e, int x, int y, bool lookAndGrab); void addToHereList(const char *entName, int x, int y); HereT *findHere(int x, int y); - void addToAutoList(int x, int y, const char *luaFuncInt, const char *luaFuncUse); + void addToAutoList(int x, int y, const char *luaFuncInit, const char *luaFuncUse); void autoDeactivate(int x, int y); bool activateAction(AIEntity *e, int x, int y, int targetX, int targetY); bool checkAutoList(AIEntity *e, int x, int y); |