Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
PathGridnode Class Reference

representation of a mapnode to be used for pathfinding More...

+ Collaboration diagram for PathGridnode:

Public Member Functions

 PathGridnode ()=default
 default constructor
 
 PathGridnode (const PathGridnode &b)
 copy constructor
 
PathGridnodeoperator= (const PathGridnode &b)
 assignment operator
 
PathCost getCost (v3s16 dir)
 read cost in a specific direction
 
void setCost (v3s16 dir, const PathCost &cost)
 set cost value for movement
 

Public Attributes

bool valid = false
 node is on surface

 
bool target = false
 node is target position

 
bool source = false
 node is stating position

 
int totalcost = -1
 cost to move here from starting point
 
int estimated_cost = -1
 totalcost + heuristic cost to end

 
v3s16 sourcedir
 origin of movement for current cost

 
v3s16 pos
 real position of node

 
PathCost directions [4]
 cost in different directions

 
bool is_closed = false
 for A* search: if true, is in closed list
 
bool is_open = false
 for A* search: if true, is in open list
 
bool is_element = false
 node is element of path detected

 
char type = 'u'
 Type of pathfinding node.
 

Detailed Description

representation of a mapnode to be used for pathfinding

Constructor & Destructor Documentation

◆ PathGridnode() [1/2]

PathGridnode::PathGridnode ( )
default

default constructor

◆ PathGridnode() [2/2]

PathGridnode::PathGridnode ( const PathGridnode & b)

copy constructor

References DIR_XM, DIR_XP, DIR_ZM, DIR_ZP, and directions.

Member Function Documentation

◆ getCost()

PathCost PathGridnode::getCost ( v3s16 dir)

read cost in a specific direction

Parameters
dirdirection of cost to fetch

References dir(), DIR_XM, DIR_XP, DIR_ZM, DIR_ZP, and directions.

Referenced by Pathfinder::updateAllCosts(), and Pathfinder::updateCostHeuristic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

PathGridnode & PathGridnode::operator= ( const PathGridnode & b)

assignment operator

Parameters
bnode to copy

References DIR_XM, DIR_XP, DIR_ZM, DIR_ZP, directions, is_element, pos, source, sourcedir, target, totalcost, type, and valid.

◆ setCost()

void PathGridnode::setCost ( v3s16 dir,
const PathCost & cost )

set cost value for movement

Parameters
dirdirection to set cost for @cost cost to set

References dir(), DIR_XM, DIR_XP, DIR_ZM, DIR_ZP, and directions.

Referenced by Pathfinder::updateCostHeuristic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ directions

PathCost PathGridnode::directions[4]

cost in different directions

Referenced by PathGridnode(), getCost(), GridNodeContainer::initNode(), operator=(), and setCost().

◆ estimated_cost

int PathGridnode::estimated_cost = -1

totalcost + heuristic cost to end

Referenced by PathfinderCompareHeuristic::operator()(), and Pathfinder::updateCostHeuristic().

◆ is_closed

bool PathGridnode::is_closed = false

for A* search: if true, is in closed list

Referenced by Pathfinder::updateCostHeuristic().

◆ is_element

bool PathGridnode::is_element = false

node is element of path detected

Referenced by Pathfinder::buildPath(), and operator=().

◆ is_open

bool PathGridnode::is_open = false

for A* search: if true, is in open list

Referenced by Pathfinder::updateCostHeuristic().

◆ pos

v3s16 PathGridnode::pos

real position of node

Referenced by Pathfinder::getPath(), GridNodeContainer::initNode(), and operator=().

◆ source

bool PathGridnode::source = false

◆ sourcedir

v3s16 PathGridnode::sourcedir

◆ target

bool PathGridnode::target = false

◆ totalcost

int PathGridnode::totalcost = -1

cost to move here from starting point

Referenced by Pathfinder::getPath(), operator=(), Pathfinder::updateAllCosts(), and Pathfinder::updateCostHeuristic().

◆ type

char PathGridnode::type = 'u'

Type of pathfinding node.

u = unknown i = invalid s = surface (walkable node)

  • = non-walkable node (e.g. air) above surface g = other non-walkable node

Referenced by GridNodeContainer::initNode(), and operator=().

◆ valid


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