Dragonfly  4.3
A text-based game engine
Public Member Functions | Private Attributes | List of all members
df::PathFind Class Reference
Collaboration diagram for df::PathFind:
Collaboration graph
[legend]

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

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

Constructor needs Object doing pathfinding, start and end locations.

Member Function Documentation

SearchResult df::PathFind::cycleOnce ( )

Go through one search cycle.

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

int df::PathFind::getNumPlies ( ) const

Return number of plies.

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

Return object seeking path.

Path df::PathFind::getPath ( ) const

Return path.

Object* df::PathFind::getTargetObject ( )

Get target object.

Pathfinding stops when target object discovered.

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

Set object seeking path.

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

Set target object.

Pathfinding stops when target object discovered.

Member Data Documentation

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

Set of nodes visited.

coord_struct df::PathFind::m_end
private

End target position.

bool df::PathFind::m_is_path
private

True if path is complete.

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

Nodes in graph.

int df::PathFind::m_num_plies
private

Number of plies cycled.

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

Set of nodes not yet visited.

Object* df::PathFind::m_p_o
private

Object finding path.

Object* df::PathFind::m_p_target_o
private

Object target (optional).

coord_struct df::PathFind::m_start
private

Start position.