1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Fix AI boat logic

This commit is contained in:
nordsoft 2023-04-18 18:33:44 +04:00
parent 3ff99a1a15
commit 37027ad17f
3 changed files with 3 additions and 3 deletions

View File

@ -864,7 +864,7 @@ void AINodeStorage::setHeroes(std::map<const CGHeroInstance *, HeroRole> 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);
}

View File

@ -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();

View File

@ -109,7 +109,7 @@ std::vector<CGPathNode *> 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;