diff --git a/lib/CPathfinder.cpp b/lib/CPathfinder.cpp index 86ebe942c..48cb15f0e 100644 --- a/lib/CPathfinder.cpp +++ b/lib/CPathfinder.cpp @@ -150,22 +150,24 @@ void CPathfinder::calculatePaths() continue; destAction = getDestAction(); - int cost = CPathfinderHelper::getMovementCost(hero, cp->coord, dp->coord, ct, dt, movement, hlp->getTurnInfo()); - int remains = movement - cost; - if(destAction == CGPathNode::EMBARK || destAction == CGPathNode::DISEMBARK) - { - remains = hero->movementPointsAfterEmbark(movement, cost, destAction - 1, hlp->getTurnInfo()); - cost = movement - remains; - } - int turnAtNextTile = turn; + int turnAtNextTile = turn, moveAtNextTile = movement; + int cost = CPathfinderHelper::getMovementCost(hero, cp->coord, dp->coord, ct, dt, moveAtNextTile, hlp->getTurnInfo()); + int remains = moveAtNextTile - cost; if(remains < 0) { //occurs rarely, when hero with low movepoints tries to leave the road hlp->updateTurnInfo(++turnAtNextTile); - int moveAtNextTile = hlp->getMaxMovePoints(i); + moveAtNextTile = hlp->getMaxMovePoints(i); cost = CPathfinderHelper::getMovementCost(hero, cp->coord, dp->coord, ct, dt, moveAtNextTile, hlp->getTurnInfo()); //cost must be updated, movement points changed :( remains = moveAtNextTile - cost; } + if(destAction == CGPathNode::EMBARK || destAction == CGPathNode::DISEMBARK) + { + /// FREE_SHIP_BOARDING bonus only remove additional penalty + /// land <-> sail transition still cost movement points as normal movement + remains = hero->movementPointsAfterEmbark(moveAtNextTile, cost, destAction - 1, hlp->getTurnInfo()); + cost = moveAtNextTile - remains; + } if(isBetterWay(remains, turnAtNextTile) && ((cp->turns == turnAtNextTile && remains) || passOneTurnLimitCheck())) diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 6a16a3656..c383aab68 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -1875,7 +1875,7 @@ bool CGameHandler::moveHero( ObjectInstanceID hid, int3 dst, ui8 teleporting, bo { tmh.movePoints = h->movementPointsAfterEmbark(h->movement, cost, false, ti); return doMove(TryMoveHero::EMBARK, IGNORE_GUARDS, DONT_VISIT_DEST, LEAVING_TILE); - //attack guards on embarking? In H3 creatures on water had no zone of control at all + // In H3 embark ignore guards } if(disembarking)