1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Added encapsulation for movement points access

This commit is contained in:
Ivan Savenko
2023-06-21 20:38:26 +03:00
parent edf7756783
commit 08cfbe79cf
24 changed files with 86 additions and 74 deletions

View File

@@ -113,7 +113,7 @@ std::vector<CGPathNode *> AINodeStorage::getInitialNodes()
auto initialNode = getOrCreateNode(hpos, hero->boat ? EPathfindingLayer::SAIL : EPathfindingLayer::LAND, NORMAL_CHAIN).value();
initialNode->turns = 0;
initialNode->moveRemains = hero->movement;
initialNode->moveRemains = hero->movementPointsRemaining();
initialNode->danger = 0;
initialNode->setCost(0.0);
@@ -245,7 +245,7 @@ void AINodeStorage::calculateTownPortalTeleportations(
auto skillLevel = hero->getSpellSchoolLevel(townPortal);
auto movementCost = GameConstants::BASE_MOVEMENT_COST * (skillLevel >= 3 ? 2 : 3);
if(hero->movement < movementCost)
if(hero->movementPointsRemaining() < movementCost)
{
return;
}