1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Simplified CollectRes - rely on VisitObj now

This commit is contained in:
DJWarmonger 2018-08-20 21:31:58 +02:00
parent 243ce7370a
commit 35d2af2e7d

View File

@ -1137,22 +1137,10 @@ TGoalVec Goals::CollectRes::getAllPossibleSubgoals()
}
for (auto obj : ourObjs)
{
int3 dest = obj->visitablePos();
auto t = sm->firstTileToGet(h, dest); //we assume that no more than one tile on the way is guarded
if (t.valid()) //we know any path at all
if (ai->isAccessibleForHero(obj->visitablePos(), h))
{
if (ai->isTileNotReserved(h, t)) //no other hero wants to conquer that tile
{
if (isSafeToVisit(h, dest))
{
if (dest != t) //there is something blocking our way
ret.push_back(sptr(Goals::ClearWayTo(dest, h).setisAbstract(true)));
else
ret.push_back(sptr(Goals::VisitObj(obj->id.getNum()).sethero(h).setisAbstract(true)));
}
else //we need to get army in order to pick that object
ret.push_back(sptr(Goals::GatherArmy(evaluateDanger(dest, h) * SAFE_ATTACK_CONSTANT).sethero(h).setisAbstract(true)));
}
//further decomposition and evaluation will be handled by VisitObj
ret.push_back(sptr(Goals::VisitObj(obj->id.getNum()).sethero(h).setisAbstract(true)));
}
}
}