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

CGPathNode: move resetting code into separate function

This commit is contained in:
ArseniyShestakov
2015-11-07 22:16:45 +03:00
parent d8a612f5d6
commit bd8eec7fb8
2 changed files with 7 additions and 6 deletions

View File

@@ -393,14 +393,9 @@ void CPathfinder::initializeGraph()
auto updateNode = [&](int3 pos, EPathfindingLayer layer, const TerrainTile *tinfo)
{
auto node = out.getNode(pos, layer);
node->locked = false;
node->reset();
node->accessible = evaluateAccessibility(pos, tinfo);
node->turns = 0xff;
node->moveRemains = 0;
node->coord = pos;
node->land = tinfo->terType != ETerrainType::WATER;
node->theNodeBefore = nullptr;
node->layer = layer;
};
int3 pos;
@@ -520,6 +515,11 @@ bool CPathfinder::canVisitObject() const
CGPathNode::CGPathNode(int3 Coord, EPathfindingLayer Layer)
: coord(Coord), layer(Layer)
{
reset();
}
void CGPathNode::reset()
{
locked = false;
accessible = NOT_SET;

View File

@@ -42,6 +42,7 @@ struct DLL_LINKAGE CGPathNode
EPathfindingLayer layer;
CGPathNode(int3 Coord, EPathfindingLayer Layer);
void reset();
bool reachable() const;
};