|
@@ -331,7 +331,7 @@ void AINodeStorage::commit(
|
|
|
destination->theNodeBefore = source->theNodeBefore;
|
|
destination->theNodeBefore = source->theNodeBefore;
|
|
|
destination->chainOther = nullptr;
|
|
destination->chainOther = nullptr;
|
|
|
|
|
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Committed %s -> %s, layer: %d, cost: %f, turn: %s, mp: %d, hero: %s, mask: %x, army: %lld",
|
|
"Committed %s -> %s, layer: %d, cost: %f, turn: %s, mp: %d, hero: %s, mask: %x, army: %lld",
|
|
|
source->coord.toString(),
|
|
source->coord.toString(),
|
|
@@ -374,7 +374,7 @@ void AINodeStorage::calculateNeighbours(
|
|
|
{
|
|
{
|
|
|
if(getAccessibility(neighbour, layer) == EPathAccessibility::NOT_SET)
|
|
if(getAccessibility(neighbour, layer) == EPathAccessibility::NOT_SET)
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Node %s rejected for %s, layer %d because of inaccessibility",
|
|
"Node %s rejected for %s, layer %d because of inaccessibility",
|
|
|
neighbour.toString(),
|
|
neighbour.toString(),
|
|
@@ -388,7 +388,7 @@ void AINodeStorage::calculateNeighbours(
|
|
|
|
|
|
|
|
if(!nextNode)
|
|
if(!nextNode)
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Failed to allocate node at %s[%d]",
|
|
"Failed to allocate node at %s[%d]",
|
|
|
neighbour.toString(),
|
|
neighbour.toString(),
|
|
@@ -397,7 +397,7 @@ void AINodeStorage::calculateNeighbours(
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Node %s added to neighbors of %s, layer %d",
|
|
"Node %s added to neighbors of %s, layer %d",
|
|
|
neighbour.toString(),
|
|
neighbour.toString(),
|
|
@@ -679,7 +679,7 @@ void HeroChainCalculationTask::cleanupInefectiveChains(std::vector<ExchangeCandi
|
|
|
auto isNotEffective = storage.hasBetterChain(chainInfo.carrierParent, chainInfo)
|
|
auto isNotEffective = storage.hasBetterChain(chainInfo.carrierParent, chainInfo)
|
|
|
|| storage.hasBetterChain(chainInfo.carrierParent, chainInfo, result);
|
|
|| storage.hasBetterChain(chainInfo.carrierParent, chainInfo, result);
|
|
|
|
|
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
if(isNotEffective)
|
|
if(isNotEffective)
|
|
|
{
|
|
{
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
@@ -725,7 +725,7 @@ void HeroChainCalculationTask::calculateHeroChain(
|
|
|
|| (node->action == EPathNodeAction::UNKNOWN && node->actor->hero)
|
|
|| (node->action == EPathNodeAction::UNKNOWN && node->actor->hero)
|
|
|
|| (node->actor->chainMask & srcNode->actor->chainMask) != 0)
|
|
|| (node->actor->chainMask & srcNode->actor->chainMask) != 0)
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Skip exchange %s[%x] -> %s[%x] at %s because of %s",
|
|
"Skip exchange %s[%x] -> %s[%x] at %s because of %s",
|
|
|
node->actor->toString(),
|
|
node->actor->toString(),
|
|
@@ -742,7 +742,7 @@ void HeroChainCalculationTask::calculateHeroChain(
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Thy exchange %s[%x] -> %s[%x] at %s",
|
|
"Thy exchange %s[%x] -> %s[%x] at %s",
|
|
|
node->actor->toString(),
|
|
node->actor->toString(),
|
|
@@ -766,7 +766,7 @@ void HeroChainCalculationTask::calculateHeroChain(
|
|
|
&& carrier->action != EPathNodeAction::BLOCKING_VISIT
|
|
&& carrier->action != EPathNodeAction::BLOCKING_VISIT
|
|
|
&& (other->armyLoss == 0 || other->armyLoss < other->actor->armyValue))
|
|
&& (other->armyLoss == 0 || other->armyLoss < other->actor->armyValue))
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Exchange allowed %s[%x] -> %s[%x] at %s",
|
|
"Exchange allowed %s[%x] -> %s[%x] at %s",
|
|
|
other->actor->toString(),
|
|
other->actor->toString(),
|
|
@@ -783,7 +783,7 @@ void HeroChainCalculationTask::calculateHeroChain(
|
|
|
|
|
|
|
|
if(hasLessMp && hasLessExperience)
|
|
if(hasLessMp && hasLessExperience)
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace("Exchange at %s is inefficient. Blocked.", carrier->coord.toString());
|
|
logAi->trace("Exchange at %s is inefficient. Blocked.", carrier->coord.toString());
|
|
|
#endif
|
|
#endif
|
|
|
return;
|
|
return;
|
|
@@ -808,7 +808,7 @@ void HeroChainCalculationTask::addHeroChain(const std::vector<ExchangeCandidate>
|
|
|
|
|
|
|
|
if(!chainNodeOptional)
|
|
if(!chainNodeOptional)
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace("Exchange at %s can not allocate node. Blocked.", carrier->coord.toString());
|
|
logAi->trace("Exchange at %s can not allocate node. Blocked.", carrier->coord.toString());
|
|
|
#endif
|
|
#endif
|
|
|
continue;
|
|
continue;
|
|
@@ -818,7 +818,7 @@ void HeroChainCalculationTask::addHeroChain(const std::vector<ExchangeCandidate>
|
|
|
|
|
|
|
|
if(exchangeNode->action != EPathNodeAction::UNKNOWN)
|
|
if(exchangeNode->action != EPathNodeAction::UNKNOWN)
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Skip exchange %s[%x] -> %s[%x] at %s because node is in use",
|
|
"Skip exchange %s[%x] -> %s[%x] at %s because node is in use",
|
|
|
other->actor->toString(),
|
|
other->actor->toString(),
|
|
@@ -832,7 +832,7 @@ void HeroChainCalculationTask::addHeroChain(const std::vector<ExchangeCandidate>
|
|
|
|
|
|
|
|
if(exchangeNode->turns != 0xFF && exchangeNode->getCost() < chainInfo.getCost())
|
|
if(exchangeNode->turns != 0xFF && exchangeNode->getCost() < chainInfo.getCost())
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Skip exchange %s[%x] -> %s[%x] at %s because not effective enough. %f < %f",
|
|
"Skip exchange %s[%x] -> %s[%x] at %s because not effective enough. %f < %f",
|
|
|
other->actor->toString(),
|
|
other->actor->toString(),
|
|
@@ -870,7 +870,7 @@ void HeroChainCalculationTask::addHeroChain(const std::vector<ExchangeCandidate>
|
|
|
exchangeNode->chainOther = other;
|
|
exchangeNode->chainOther = other;
|
|
|
exchangeNode->armyLoss = chainInfo.armyLoss;
|
|
exchangeNode->armyLoss = chainInfo.armyLoss;
|
|
|
|
|
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Chain accepted at %s %s -> %s, mask %x, cost %f, turn: %s, mp: %d, army %i",
|
|
"Chain accepted at %s %s -> %s, mask %x, cost %f, turn: %s, mp: %d, army %i",
|
|
|
exchangeNode->coord.toString(),
|
|
exchangeNode->coord.toString(),
|
|
@@ -1211,7 +1211,7 @@ void AINodeStorage::calculateTownPortal(
|
|
|
|
|
|
|
|
if(nodeOptional)
|
|
if(nodeOptional)
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 1
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 1
|
|
|
logAi->trace("Adding town portal node at %s", targetTown->getObjectName());
|
|
logAi->trace("Adding town portal node at %s", targetTown->getObjectName());
|
|
|
#endif
|
|
#endif
|
|
|
output.push_back(nodeOptional.value());
|
|
output.push_back(nodeOptional.value());
|
|
@@ -1321,7 +1321,7 @@ bool AINodeStorage::isOtherChainBetter(
|
|
|
{
|
|
{
|
|
|
if(other.getCost() < candidateNode.getCost())
|
|
if(other.getCost() < candidateNode.getCost())
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Block inefficient battle move %s->%s, hero: %s[%X], army %lld, mp diff: %i",
|
|
"Block inefficient battle move %s->%s, hero: %s[%X], army %lld, mp diff: %i",
|
|
|
source->coord.toString(),
|
|
source->coord.toString(),
|
|
@@ -1345,7 +1345,7 @@ bool AINodeStorage::isOtherChainBetter(
|
|
|
if(nodeArmyValue > candidateArmyValue
|
|
if(nodeArmyValue > candidateArmyValue
|
|
|
&& other.getCost() <= candidateNode.getCost())
|
|
&& other.getCost() <= candidateNode.getCost())
|
|
|
{
|
|
{
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Block inefficient move because of stronger army %s->%s, hero: %s[%X], army %lld, mp diff: %i",
|
|
"Block inefficient move because of stronger army %s->%s, hero: %s[%X], army %lld, mp diff: %i",
|
|
|
source->coord.toString(),
|
|
source->coord.toString(),
|
|
@@ -1371,7 +1371,7 @@ bool AINodeStorage::isOtherChainBetter(
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#if NKAI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
|
|
|
|
+#if NK2AI_PATHFINDER_TRACE_LEVEL >= 2
|
|
|
logAi->trace(
|
|
logAi->trace(
|
|
|
"Block inefficient move because of stronger hero %s->%s, hero: %s[%X], army %lld, mp diff: %i",
|
|
"Block inefficient move because of stronger hero %s->%s, hero: %s[%X], army %lld, mp diff: %i",
|
|
|
source->coord.toString(),
|
|
source->coord.toString(),
|