diff options
author | Nipun Garg | 2019-06-22 08:58:22 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:55 +0200 |
commit | ab0402622eb48d7df68466c98ff08686b1d46603 (patch) | |
tree | 4917a3b1356d337ecb256b024d70414d7981c10f | |
parent | 43f6a0a475dfd403db80c3645029f8f20e14ca2b (diff) | |
download | scummvm-rg350-ab0402622eb48d7df68466c98ff08686b1d46603.tar.gz scummvm-rg350-ab0402622eb48d7df68466c98ff08686b1d46603.tar.bz2 scummvm-rg350-ab0402622eb48d7df68466c98ff08686b1d46603.zip |
HDB: Add findEntity()
-rw-r--r-- | engines/hdb/ai-funcs.cpp | 17 | ||||
-rw-r--r-- | engines/hdb/ai.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp index 9faafe1bf6..f81a65fc92 100644 --- a/engines/hdb/ai-funcs.cpp +++ b/engines/hdb/ai-funcs.cpp @@ -512,6 +512,23 @@ AIEntity *AI::locateEntity(const char *luaName) { return NULL; } +AIEntity *AI::findEntity(int x, int y) { + for (Common::Array<AIEntity *>::iterator it = _ents->begin(); it != _ents->end(); it++) { + if ((*it)->tileX == x && (*it)->tileY == y) { + return *it; + } + } + + for (Common::Array<AIEntity *>::iterator it = _floats->begin(); it != _floats->end(); it++) { + if ((*it)->tileX == x && (*it)->tileY == y) { + return *it; + } + } + + warning("STUB: findEntity: Check for Laser"); + return NULL; +} + void AI::removeEntity(AIEntity *e) { _ents->erase(&e); } diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 632a9559b3..334725c217 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -615,6 +615,7 @@ public: bool cacheEntGfx(AIEntity *e, bool init); void stopEntity(AIEntity *e); AIEntity *locateEntity(const char *luaName); + AIEntity *findEntity(int x, int y); void removeEntity(AIEntity *e); void setEntityGoal(AIEntity *e, int x, int y); void initAllEnts(); |