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:
parent
3ff99a1a15
commit
37027ad17f
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user