Dragonfly 4.20
A text-based game engine
Public Member Functions | Private Attributes | List of all members
df::PathFind Class Reference

Public Member Functions

 PathFind (Object *p_o, Vector start, Vector end)
 
SearchResult cycleOnce ()
 
Path getPath () const
 
void setObject (Object *new_p_o)
 
ObjectgetObject () const
 
int getNumPlies () const
 
void setTargetObject (Object *p_target_o)
 
ObjectgetTargetObject ()
 

Private Attributes

Objectm_p_o
 
Objectm_p_target_o
 
coord_struct m_start
 
coord_struct m_end
 
struct node_struct ** m_node
 
std::vector< coord_structm_open_set
 
std::vector< coord_structm_closed_set
 
int m_num_plies
 
bool m_is_path
 

Constructor & Destructor Documentation

◆ PathFind()

df::PathFind::PathFind ( Object p_o,
Vector  start,
Vector  end 
)

Constructor needs Object doing pathfinding, start and end positions.

Member Function Documentation

◆ cycleOnce()

SearchResult df::PathFind::cycleOnce ( )

Go through one search cycle.


Returns indication if found path {found, not found, incomplete}.

◆ getNumPlies()

int df::PathFind::getNumPlies ( ) const

Return number of plies.

◆ getObject()

Object * df::PathFind::getObject ( ) const

Return object seeking path.

◆ getPath()

Path df::PathFind::getPath ( ) const

Return path.

◆ getTargetObject()

Object * df::PathFind::getTargetObject ( )

Get target object.

Pathfinding stops when target object discovered.

◆ setObject()

void df::PathFind::setObject ( Object new_p_o)

Set object seeking path.

◆ setTargetObject()

void df::PathFind::setTargetObject ( Object p_target_o)

Set target object.

Pathfinding stops when target object discovered.

Member Data Documentation

◆ m_closed_set

std::vector<coord_struct> df::PathFind::m_closed_set
private

Set of nodes visited.

◆ m_end

coord_struct df::PathFind::m_end
private

End target position.

◆ m_is_path

bool df::PathFind::m_is_path
private

True if path is complete.

◆ m_node

struct node_struct** df::PathFind::m_node
private

All nodes in 2d graph/grid.

◆ m_num_plies

int df::PathFind::m_num_plies
private

Number of plies cycled.

◆ m_open_set

std::vector<coord_struct> df::PathFind::m_open_set
private

Set of nodes not yet visited.

◆ m_p_o

Object* df::PathFind::m_p_o
private

Object finding path.

◆ m_p_target_o

Object* df::PathFind::m_p_target_o
private

Object target (optional).

◆ m_start

coord_struct df::PathFind::m_start
private

Start position.