mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Rename getCost back to getMovementCost
Initially wanter to name main class differently and back then getCost make sense. Then renamed class to CPathfinderHelper, but forgot to rename function back.
This commit is contained in:
parent
b2e1ee5363
commit
2ef9d7c3ec
@ -421,7 +421,7 @@ float FuzzyHelper::evaluate (Goals::VisitTile & g)
|
||||
|
||||
//assert(cb->isInTheMap(g.tile));
|
||||
float turns = 0;
|
||||
float distance = CPathfinderHelper::getCost(g.hero.h, g.tile);
|
||||
float distance = CPathfinderHelper::getMovementCost(g.hero.h, g.tile);
|
||||
if (!distance) //we stand on that tile
|
||||
turns = 0;
|
||||
else
|
||||
|
@ -143,7 +143,7 @@ void CPathfinder::calculatePaths()
|
||||
if(!isMovementToDestPossible())
|
||||
continue;
|
||||
|
||||
int cost = CPathfinderHelper::getCost(hero, cp->coord, dp->coord, movement);
|
||||
int cost = CPathfinderHelper::getMovementCost(hero, cp->coord, dp->coord, movement);
|
||||
int remains = movement - cost;
|
||||
if(destAction == CGPathNode::EMBARK || destAction == CGPathNode::DISEMBARK)
|
||||
{
|
||||
@ -156,7 +156,7 @@ void CPathfinder::calculatePaths()
|
||||
//occurs rarely, when hero with low movepoints tries to leave the road
|
||||
turnAtNextTile++;
|
||||
int moveAtNextTile = maxMovePoints(cp);
|
||||
cost = CPathfinderHelper::getCost(hero, cp->coord, dp->coord, moveAtNextTile); //cost must be updated, movement points changed :(
|
||||
cost = CPathfinderHelper::getMovementCost(hero, cp->coord, dp->coord, moveAtNextTile); //cost must be updated, movement points changed :(
|
||||
remains = moveAtNextTile - cost;
|
||||
}
|
||||
|
||||
@ -664,7 +664,7 @@ void CPathfinderHelper::getNeighbours(CGameState * gs, const TerrainTile &srct,
|
||||
}
|
||||
}
|
||||
|
||||
int CPathfinderHelper::getCost(const CGHeroInstance * h, const int3 &src, const int3 &dst, const int &remainingMovePoints, const int &turn, const bool &checkLast)
|
||||
int CPathfinderHelper::getMovementCost(const CGHeroInstance * h, const int3 &src, const int3 &dst, const int &remainingMovePoints, const int &turn, const bool &checkLast)
|
||||
{
|
||||
if(src == dst) //same tile
|
||||
return 0;
|
||||
@ -705,7 +705,7 @@ int CPathfinderHelper::getCost(const CGHeroInstance * h, const int3 &src, const
|
||||
getNeighbours(h->cb->gameState(), *d, dst, vec, s->terType != ETerrainType::WATER, true);
|
||||
for(auto & elem : vec)
|
||||
{
|
||||
int fcost = getCost(h, dst, elem, left, turn, false);
|
||||
int fcost = getMovementCost(h, dst, elem, left, turn, false);
|
||||
if(fcost <= left)
|
||||
return ret;
|
||||
}
|
||||
@ -714,9 +714,9 @@ int CPathfinderHelper::getCost(const CGHeroInstance * h, const int3 &src, const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int CPathfinderHelper::getCost(const CGHeroInstance * h, const int3 &dst)
|
||||
int CPathfinderHelper::getMovementCost(const CGHeroInstance * h, const int3 &dst)
|
||||
{
|
||||
return getCost(h, h->visitablePos(), dst, h->movement);
|
||||
return getMovementCost(h, h->visitablePos(), dst, h->movement);
|
||||
}
|
||||
|
||||
CGPathNode::CGPathNode(int3 Coord, ELayer Layer)
|
||||
|
@ -184,6 +184,6 @@ class DLL_LINKAGE CPathfinderHelper
|
||||
public:
|
||||
static void getNeighbours(CGameState * gs, const TerrainTile &srct, const int3 &tile, std::vector<int3> &vec, const boost::logic::tribool &onLand, const bool &limitCoastSailing);
|
||||
|
||||
static int getCost(const CGHeroInstance * h, const int3 &src, const int3 &dst, const int &remainingMovePoints =- 1, const int &turn = 0, const bool &checkLast = true);
|
||||
static int getCost(const CGHeroInstance * h, const int3 &dst);
|
||||
static int getMovementCost(const CGHeroInstance * h, const int3 &src, const int3 &dst, const int &remainingMovePoints =- 1, const int &turn = 0, const bool &checkLast = true);
|
||||
static int getMovementCost(const CGHeroInstance * h, const int3 &dst);
|
||||
};
|
||||
|
@ -1780,7 +1780,7 @@ bool CGameHandler::moveHero( ObjectInstanceID hid, int3 dst, ui8 teleporting, bo
|
||||
//check if destination tile is available
|
||||
const bool canFly = h->getBonusAtTurn(Bonus::FLYING_MOVEMENT);
|
||||
const bool canWalkOnSea = h->getBonusAtTurn(Bonus::WATER_WALKING);
|
||||
const int cost = CPathfinderHelper::getCost(h, h->getPosition(), hmpos, h->movement);
|
||||
const int cost = CPathfinderHelper::getMovementCost(h, h->getPosition(), hmpos, h->movement);
|
||||
|
||||
//it's a rock or blocked and not visitable tile
|
||||
//OR hero is on land and dest is water and (there is not present only one object - boat)
|
||||
|
Loading…
Reference in New Issue
Block a user