MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / connect

Method connect

src/Battlescape/PathfindingNode.cpp:108–119  ·  view source on GitHub ↗

* Connects the node. This will connect the node to the previous node along the path to @a target * and update the pathfinding information. * @param tuCost The total cost of the path so far. * @param prevNode The previous node along the path. * @param prevDir The direction FROM the previous node. * @param target The target position (used to update our guess cost). */

Source from the content-addressed store, hash-verified

106 * @param target The target position (used to update our guess cost).
107*/
108void PathfindingNode::connect(int tuCost, PathfindingNode* prevNode, int prevDir, const Position &target)
109{
110 _tuCost = tuCost;
111 _prevNode = prevNode;
112 _prevDir = prevDir;
113 if (!inOpenSet()) // Otherwise we have this already.
114 {
115 Position d = target - _pos;
116 d *= d;
117 _tuGuess = 4 * sqrt((double)d.x + d.y + d.z);
118 }
119}
120
121/**
122 * Connects the node. This will connect the node to the previous node along the path.

Callers 2

aStarPathMethod · 0.80
findReachableMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected