1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Fixed AI getting stuck at blockVisit objects (Tavern, Borderguards/gates etc).

This commit is contained in:
DjWarmonger
2016-11-28 19:29:11 +01:00
parent a1b7c9d8d2
commit 9b5af484b7
3 changed files with 28 additions and 7 deletions

View File

@@ -400,11 +400,19 @@ int3 whereToExplore(HeroPtr h)
}
}
bool isBlockedBorderGate(int3 tileToHit)
bool isBlockedBorderGate(int3 tileToHit) //TODO: is that function needed? should be handled by pathfinder
{
return cb->getTile(tileToHit)->topVisitableId() == Obj::BORDER_GATE &&
(dynamic_cast <const CGKeys *>(cb->getTile(tileToHit)->visitableObjects.back()))->wasMyColorVisited (ai->playerID);
}
bool isBlockVisitObj(const int3 &pos)
{
if (auto obj = cb->getTopObj(pos))
if (obj->blockVisit) //we can't stand on that object
return true;
return false;
}
int howManyTilesWillBeDiscovered(const int3 &pos, int radious, CCallback * cbp)
{ //TODO: do not explore dead-end boundaries