1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00
This commit is contained in:
AlexVinS 2019-01-08 00:49:36 +03:00
parent f1cd4656ff
commit f0492ffa53
2 changed files with 5 additions and 3 deletions

View File

@ -23,11 +23,11 @@ private:
CPlayerSpecificInfoCallback * cb;
VCAI * ai;
std::shared_ptr<AINodeStorage> getOrCreateStorage(HeroPtr hero);
public:
AIPathfinder(CPlayerSpecificInfoCallback * cb, VCAI * ai);
std::vector<AIPath> getPathInfo(HeroPtr hero, int3 tile);
bool isTileAccessible(HeroPtr hero, int3 tile);
std::shared_ptr<AINodeStorage> getOrCreateStorage(HeroPtr hero);
void clear();
void init();
};

View File

@ -37,6 +37,7 @@ Goals::TGoalVec PathfindingManager::howToVisitTile(int3 tile)
Goals::TGoalVec result;
auto heroes = cb->getHeroesInfo();
result.reserve(heroes.size());
for(auto hero : heroes)
{
@ -51,6 +52,7 @@ Goals::TGoalVec PathfindingManager::howToVisitObj(ObjectIdRef obj)
Goals::TGoalVec result;
auto heroes = cb->getHeroesInfo();
result.reserve(heroes.size());
for(auto hero : heroes)
{
@ -154,7 +156,7 @@ Goals::TGoalVec PathfindingManager::findPath(
if(solution->evaluationContext.danger < danger)
solution->evaluationContext.danger = danger;
solution->evaluationContext.movementCost += path.movementCost();
logAi->trace("It's safe for %s to visit tile %s with danger %s, goal %s", hero->name, dest.toString(), std::to_string(danger), solution->name());
@ -219,7 +221,7 @@ Goals::TSubgoal PathfindingManager::clearWayTo(HeroPtr hero, int3 firstTileToGet
}
auto questObj = dynamic_cast<const IQuestObject*>(topObj);
if(questObj)
{
auto questInfo = QuestInfo(questObj->quest, topObj, topObj->visitablePos());