1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Important fixes:

- AI will not always trade resources if it has better options
- Do not use reserved objects for CollectRes
This commit is contained in:
DJWarmonger
2018-08-21 13:48:19 +02:00
parent 2f4b463459
commit 6503830bde
2 changed files with 6 additions and 5 deletions

View File

@@ -1142,10 +1142,11 @@ TGoalVec Goals::CollectRes::getAllPossibleSubgoals()
}
for (auto obj : ourObjs)
{
if (ai->isAccessibleForHero(obj->visitablePos(), h))
auto pos = obj->visitablePos();
if (ai->isAccessibleForHero(pos, h))
{
//further decomposition and evaluation will be handled by VisitObj
ret.push_back(sptr(Goals::VisitObj(obj->id.getNum()).sethero(h).setisAbstract(true)));
if (ai->isTileNotReserved(h, pos)) //further decomposition and evaluation will be handled by VisitObj
ret.push_back(sptr(Goals::VisitObj(obj->id.getNum()).sethero(h).setisAbstract(true)));
}
}
}

View File

@@ -432,7 +432,7 @@ public:
resID = rid;
value = val;
objid = Objid;
priority = 10; //do it immediately
priority = 3; //trading is instant, but picking resources is free
}
TSubgoal whatToDoToAchieve() override;
bool operator==(AbstractGoal & g) override;