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

Nullkiller: stabilization

This commit is contained in:
Andrii Danylchenko
2021-05-16 14:56:49 +03:00
committed by Andrii Danylchenko
parent e385c83a88
commit cf4484e071
4 changed files with 10 additions and 15 deletions

View File

@@ -78,7 +78,7 @@ Goals::TGoalVec GatherArmyBehavior::deliverArmyToHero(const CGHeroInstance * her
auto paths = ai->nullkiller->pathfinder->getPathInfo(pos); auto paths = ai->nullkiller->pathfinder->getPathInfo(pos);
#if AI_TRACE_LEVEL >= 1 #if AI_TRACE_LEVEL >= 1
logAi->trace("Found %d paths", paths.size()); logAi->trace("Gather army found %d paths", paths.size());
#endif #endif
for(const AIPath & path : paths) for(const AIPath & path : paths)

View File

@@ -712,7 +712,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task)
logAi->error("evaluate VisitTile: %s", fe.getWhat()); logAi->error("evaluate VisitTile: %s", fe.getWhat());
} }
#ifdef AI_TRACE_LEVEL >= 1 #ifdef AI_TRACE_LEVEL >= 2
logAi->trace("Evaluated %s, loss: %f, turn: %d, turns main: %f, scout: %f, gold: %d, cost: %d, army gain: %d, danger: %d, role: %s, strategical value: %f, cwr: %f, fear: %f, result %f", logAi->trace("Evaluated %s, loss: %f, turn: %d, turns main: %f, scout: %f, gold: %d, cost: %d, army gain: %d, danger: %d, role: %s, strategical value: %f, cwr: %f, fear: %f, result %f",
task->toString(), task->toString(),
evaluationContext.armyLossPersentage, evaluationContext.armyLossPersentage,

View File

@@ -120,19 +120,14 @@ std::string CompleteQuest::questToString() const
TGoalVec CompleteQuest::tryCompleteQuest() const TGoalVec CompleteQuest::tryCompleteQuest() const
{ {
TGoalVec solutions; auto paths = ai->nullkiller->pathfinder->getPathInfo(q.obj->visitablePos());
auto tasks = CaptureObjectsBehavior(q.obj).decompose(); vstd::erase_if(paths, [&](const AIPath & path) -> bool
for(auto task : tasks)
{ {
if(task->hero && q.quest->checkQuest(task->hero.get())) return !q.quest->checkQuest(path.targetHero);
{ });
solutions.push_back(task);
} return CaptureObjectsBehavior::getVisitGoals(paths, q.obj);
}
return solutions;
} }
TGoalVec CompleteQuest::missionArt() const TGoalVec CompleteQuest::missionArt() const
@@ -159,7 +154,7 @@ TGoalVec CompleteQuest::missionHero() const
if(solutions.empty()) if(solutions.empty())
{ {
//rule of a thumb - quest heroes usually are locked in prisons //rule of a thumb - quest heroes usually are locked in prisons
return CaptureObjectsBehavior().ofType(Obj::PRISON).decompose(); solutions.push_back(sptr(CaptureObjectsBehavior().ofType(Obj::PRISON)));
} }
return solutions; return solutions;

View File

@@ -11,7 +11,7 @@
#pragma once #pragma once
#define PATHFINDER_TRACE_LEVEL 0 #define PATHFINDER_TRACE_LEVEL 0
#define AI_TRACE_LEVEL 1 #define AI_TRACE_LEVEL 0
#define SCOUT_TURN_DISTANCE_LIMIT 3 #define SCOUT_TURN_DISTANCE_LIMIT 3
#include "../../../lib/CPathfinder.h" #include "../../../lib/CPathfinder.h"