From ab06602332b3a10029127656dbc23471c3237f3e Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Sat, 6 Jul 2019 00:56:45 +0530 Subject: HDB: Add clearDiverters() --- engines/hdb/ai-funcs.cpp | 10 ++++++++++ engines/hdb/ai.h | 1 + 2 files changed, 11 insertions(+) (limited to 'engines/hdb') diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp index ef32d51795..ed5183fb27 100644 --- a/engines/hdb/ai-funcs.cpp +++ b/engines/hdb/ai-funcs.cpp @@ -2033,6 +2033,16 @@ bool AI::checkPlayerCollision(int x, int y, int border) { return (x > (_player->x - 32 + border) && x < (_player->x - 32 - border) && y >(_player->y - 32 + border) && y < (_player->y - 32 - border)); } +void AI::clearDiverters() { + AIEntity *e; + + for (uint i = 0; i < _ents->size(); i++) { + e = _ents->operator[](i); + if (e->type == AI_DIVERTER) + e->value1 = e->value2 = 0; + } +} + void AI::floatEntity(AIEntity *e, AIState state) { for (Common::Array::iterator it = _ents->begin(); it != _ents->end(); it++) { if (e == *it) { diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 59306389a0..098b4d3ab0 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -836,6 +836,7 @@ public: AIEntity *playerCollision(int topBorder, int bottomBorder, int leftBorder, int rightBorder); bool checkPlayerTileCollision(int x, int y); bool checkPlayerCollision(int x, int y, int border); + void clearDiverters(); // List functions void addToActionList(int actionIndex, int x, int y, char *funcLuaInit, char *funcLuaUse); -- cgit v1.2.3