HDB: Add findEntity()

This commit is contained in:
Nipun Garg 2019-06-22 08:58:22 +05:30 committed by Eugene Sandulenko
parent 43f6a0a475
commit ab0402622e
2 changed files with 18 additions and 0 deletions

View File

@ -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);
}

View File

@ -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();