From 6848a52ce1aad6b41cfc83f581a6f095c8e3794a Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Mon, 19 Dec 2016 21:46:01 +0100 Subject: [PATCH] Fixed heroes not unreserving Teleports, which makes them wander around it endlessly and blocking path. TODO: properly handle all Teleports as "visited" objects --- AI/VCAI/VCAI.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index c32b2211d..abe715362 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -132,6 +132,9 @@ void VCAI::heroMoved(const TryMoveHero & details) } } } + //FIXME: teleports are not correctly visited + unreserveObject(hero, t1); + unreserveObject(hero, t2); } else if(details.result == TryMoveHero::EMBARK && hero) { @@ -1681,7 +1684,9 @@ void VCAI::waitTillFree() void VCAI::markObjectVisited (const CGObjectInstance *obj) { - if(dynamic_cast(obj) || //we may want to wisit it with another hero + if(!obj) + return; + if(dynamic_cast(obj) || //we may want to visit it with another hero dynamic_cast(obj) || //or another time (obj->ID == Obj::MONSTER)) return; @@ -1976,6 +1981,7 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h) doTeleportMovement(destTeleportObj->id, nextCoord); if(teleportChannelProbingList.size()) doChannelProbing(); + markObjectVisited(destTeleportObj); //FIXME: Monoliths are not correctly visited continue; } @@ -3245,7 +3251,6 @@ bool shouldVisit(HeroPtr h, const CGObjectInstance * obj) case Obj::MONOLITH_ONE_WAY_EXIT: case Obj::MONOLITH_TWO_WAY: case Obj::WHIRLPOOL: - //TODO: mechanism for handling monoliths return false; case Obj::SCHOOL_OF_MAGIC: case Obj::SCHOOL_OF_WAR: