From 37027ad17f6d83440f1f632fc480f8a0e03af2c3 Mon Sep 17 00:00:00 2001 From: nordsoft Date: Tue, 18 Apr 2023 18:33:44 +0400 Subject: [PATCH] Fix AI boat logic --- AI/Nullkiller/Pathfinding/AINodeStorage.cpp | 2 +- AI/Nullkiller/Pathfinding/Actors.cpp | 2 +- AI/VCAI/Pathfinding/AINodeStorage.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp index 8fd97a975..a7dd39a3e 100644 --- a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp +++ b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp @@ -864,7 +864,7 @@ void AINodeStorage::setHeroes(std::map heroes) if(actor->hero->tempOwner != ai->playerID) { - bool onLand = !actor->hero->boat; + bool onLand = !actor->hero->boat || actor->hero->boat->layer != EPathfindingLayer::SAIL; actor->initialMovement = actor->hero->maxMovePoints(onLand); } diff --git a/AI/Nullkiller/Pathfinding/Actors.cpp b/AI/Nullkiller/Pathfinding/Actors.cpp index 59309f450..0721e6f3f 100644 --- a/AI/Nullkiller/Pathfinding/Actors.cpp +++ b/AI/Nullkiller/Pathfinding/Actors.cpp @@ -42,7 +42,7 @@ ChainActor::ChainActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t baseActor(this), carrierParent(nullptr), otherParent(nullptr), actorExchangeCount(1), armyCost(), actorAction() { initialPosition = hero->visitablePos(); - layer = hero->boat ? EPathfindingLayer::SAIL : EPathfindingLayer::LAND; + layer = hero->boat ? hero->boat->layer : EPathfindingLayer::LAND; initialMovement = hero->movement; initialTurn = 0; armyValue = hero->getArmyStrength(); diff --git a/AI/VCAI/Pathfinding/AINodeStorage.cpp b/AI/VCAI/Pathfinding/AINodeStorage.cpp index 719e93903..1d2eaf604 100644 --- a/AI/VCAI/Pathfinding/AINodeStorage.cpp +++ b/AI/VCAI/Pathfinding/AINodeStorage.cpp @@ -109,7 +109,7 @@ std::vector AINodeStorage::getInitialNodes() { auto hpos = hero->visitablePos(); auto initialNode = - getOrCreateNode(hpos, hero->boat ? EPathfindingLayer::SAIL : EPathfindingLayer::LAND, NORMAL_CHAIN) + getOrCreateNode(hpos, hero->boat ? hero->boat->layer : EPathfindingLayer::LAND, NORMAL_CHAIN) .get(); initialNode->turns = 0;