OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
OpenXcom::PathfindingNode Class Reference

A class that holds pathfinding info for a certain node on the map. More...

#include <PathfindingNode.h>

Public Member Functions

 PathfindingNode (Position pos)
 Creates a new PathfindingNode class. More...
 
 ~PathfindingNode ()
 Cleans up the PathfindingNode. More...
 
const PositiongetPosition () const
 Gets the node position. More...
 
void reset ()
 Resets the node.
 
bool isChecked () const
 Is checked? More...
 
void setChecked ()
 Marks the node as checked.
 
int getTUCost (bool missile) const
 Gets the TU cost. More...
 
PathfindingNodegetPrevNode () const
 Gets the previous node. More...
 
int getPrevDir () const
 Gets the previous walking direction. More...
 
bool inOpenSet () const
 Is this node already in a PathfindingOpenSet?
 
int getTUGuess () const
 Gets the approximate cost to reach the target position.
 
void connect (int tuCost, PathfindingNode *prevNode, int prevDir, const Position &target)
 Connects to previous node along the path. More...
 
void connect (int tuCost, PathfindingNode *prevNode, int prevDir)
 Connects to previous node along a visit. More...
 

Detailed Description

A class that holds pathfinding info for a certain node on the map.

Constructor & Destructor Documentation

OpenXcom::PathfindingNode::PathfindingNode ( Position  pos)

Creates a new PathfindingNode class.

Sets up a PathfindingNode.

Parameters
posPosition.
OpenXcom::PathfindingNode::~PathfindingNode ( )

Cleans up the PathfindingNode.

Deletes the PathfindingNode.

Member Function Documentation

void OpenXcom::PathfindingNode::connect ( int  tuCost,
PathfindingNode prevNode,
int  prevDir,
const Position target 
)

Connects to previous node along the path.

Connects the node.

This will connect the node to the previous node along the path to target and update the pathfinding information.

Parameters
tuCostThe total cost of the path so far.
prevNodeThe previous node along the path.
prevDirThe direction FROM the previous node.
targetThe target position (used to update our guess cost).
void OpenXcom::PathfindingNode::connect ( int  tuCost,
PathfindingNode prevNode,
int  prevDir 
)

Connects to previous node along a visit.

Connects the node.

This will connect the node to the previous node along the path.

Parameters
tuCostThe total cost of the path so far.
prevNodeThe previous node along the path.
prevDirThe direction FROM the previous node.
const Position & OpenXcom::PathfindingNode::getPosition ( ) const

Gets the node position.

Returns
Node position.
int OpenXcom::PathfindingNode::getPrevDir ( ) const

Gets the previous walking direction.

Gets the previous walking direction for how we got on this node.

Returns
Previous vector.
PathfindingNode * OpenXcom::PathfindingNode::getPrevNode ( ) const

Gets the previous node.

Returns
Pointer to the previous node.
int OpenXcom::PathfindingNode::getTUCost ( bool  missile) const

Gets the TU cost.

Parameters
missileIs this a missile?
Returns
The TU cost.
bool OpenXcom::PathfindingNode::isChecked ( ) const

Is checked?

Gets the checked status of this node.

Returns
True, if this node was checked.

The documentation for this class was generated from the following files: