From 5ec3685041550a1829c0bb701e377dc2063a0d35 Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Sat, 21 Dec 2013 07:37:23 +0000 Subject: [PATCH] Fixed heroes getting stuck because their assigned tile was captured by another hero. --- AI/VCAI/Goals.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AI/VCAI/Goals.cpp b/AI/VCAI/Goals.cpp index ddbafc74d..b4c1c1b60 100644 --- a/AI/VCAI/Goals.cpp +++ b/AI/VCAI/Goals.cpp @@ -493,7 +493,13 @@ TGoalVec VisitTile::getAllPossibleSubgoals() ret.push_back (sptr(Goals::Explore())); //what sense does it make? else { - for (auto h : cb->getHeroesInfo()) + std::vector heroes; + if (hero) + heroes.push_back(hero.h); //use assigned hero if any + else + heroes = cb->getHeroesInfo(); //use most convenient hero + + for (auto h : heroes) { if (ai->isAccessibleForHero(tile, h)) ret.push_back (sptr(Goals::VisitTile(tile).sethero(h)));