mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Simplified CollectRes - rely on VisitObj now
This commit is contained in:
parent
243ce7370a
commit
35d2af2e7d
@ -1137,23 +1137,11 @@ 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
|
||||
//further decomposition and evaluation will be handled by VisitObj
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user