1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Pathfinding: restore gamestate usage to avoid overhead

Also when possible pass TerrainTile pointers to getMovementCost instead of using getTile.
This commit is contained in:
ArseniyShestakov
2015-11-21 14:31:30 +03:00
parent 438a444443
commit a1fe2ebc44
3 changed files with 24 additions and 20 deletions

View File

@ -1781,7 +1781,7 @@ bool CGameHandler::moveHero( ObjectInstanceID hid, int3 dst, ui8 teleporting, bo
auto ti = new TurnInfo(h);
const bool canFly = ti->hasBonusOfType(Bonus::FLYING_MOVEMENT);
const bool canWalkOnSea = ti->hasBonusOfType(Bonus::WATER_WALKING);
const int cost = CPathfinderHelper::getMovementCost(h, h->getPosition(), hmpos, h->movement, ti);
const int cost = CPathfinderHelper::getMovementCost(h, h->getPosition(), hmpos, nullptr, nullptr, h->movement, ti);
//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)