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:
@@ -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;
|
||||
|
||||
@@ -42,6 +42,7 @@ struct DLL_LINKAGE CGPathNode
|
||||
EPathfindingLayer layer;
|
||||
|
||||
CGPathNode(int3 Coord, EPathfindingLayer Layer);
|
||||
void reset();
|
||||
bool reachable() const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user