1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

CPathfinder: move flying into options and add walk on sea

This commit is contained in:
ArseniyShestakov
2015-10-12 19:03:08 +03:00
parent 41c4323818
commit 9954dfb33a
2 changed files with 8 additions and 3 deletions

View File

@ -3417,7 +3417,6 @@ bool CPathfinder::checkDestinationTile()
void CPathfinder::calculatePaths()
{
bool flying = hero->hasBonusOfType(Bonus::FLYING_MOVEMENT);
int maxMovePointsLand = hero->maxMovePoints(true);
int maxMovePointsWater = hero->maxMovePoints(false);
@ -3457,7 +3456,7 @@ void CPathfinder::calculatePaths()
if(!isMovementPossible())
continue;
int cost = gs->getMovementCost(hero, cp->coord, dp->coord, flying, movement);
int cost = gs->getMovementCost(hero, cp->coord, dp->coord, vstd::contains(options, EOptions::FLYING), movement);
int remains = movement - cost;
if(useEmbarkCost)
{
@ -3471,7 +3470,7 @@ void CPathfinder::calculatePaths()
//occurs rarely, when hero with low movepoints tries to leave the road
turnAtNextTile++;
int moveAtNextTile = maxMovePoints(cp);
cost = gs->getMovementCost(hero, cp->coord, dp->coord, flying, moveAtNextTile); //cost must be updated, movement points changed :(
cost = gs->getMovementCost(hero, cp->coord, dp->coord, vstd::contains(options, EOptions::FLYING), moveAtNextTile); //cost must be updated, movement points changed :(
remains = moveAtNextTile - cost;
}
@ -3612,6 +3611,10 @@ CPathfinder::CPathfinder(CPathsInfo &_out, CGameState *_gs, const CGHeroInstance
initializeGraph();
if(hero->canFly())
options.insert(EOptions::FLYING);
else if(hero->canWalkOnSea())
options.insert(EOptions::WALKING_ON_SEA);
options.insert(EOptions::EMBARK_AND_DISEMBARK);
options.insert(EOptions::TELEPORT_TWO_WAY);
options.insert(EOptions::TELEPORT_ONE_WAY);