Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

cPath Class Reference

Class implementation of a pathfinding algorithm similar to an A* one. More...

#include <ai.h>

List of all members.

Public Methods

 cPath (Location startPos, Location finalPos, P_CHAR pc=NULL)
void exec ()
Location getNextPos ()
Location getFinalPos ()
LOGICAL targetReached ()
LOGICAL pathFound ()

Private Methods

path_nodecreate_node (Location pos, path_node *parentNode, UI32 cost)
UI08 addReachableNodes (path_node *node)
 Looks for every tile reachable walking by pos, and adds them to the open list.

void dropToClosedList (path_node *node)
 Insert an element in the closed list, and removes it from the open list if present.

void addToOpenList (Location pos, path_node *parentNode, UI32 cost=10)
 Adds an element to the open list.

void addToOpenList (path_node *node)
 Adds an element to the open list.

void addToClosedList (path_node *node)
 Adds an element to the closed list.


Private Attributes

LOGICAL m_pathFound
UI32 m_loops
SERIAL pc_serial
path_nodecurrNode
path_nodenextNode
queue< path_nodenodes_vector
Location m_startPos
Location m_finalPos
NODE_LIST open_list
NODE_LIST closed_list
LOCATION_LIST path_list


Detailed Description

Class implementation of a pathfinding algorithm similar to an A* one.

Author:
Luxor


Constructor & Destructor Documentation

cPath::cPath Location    startPos,
Location    finalPos,
P_CHAR    pc = NULL
 

Author:
Luxor


Member Function Documentation

UI08 cPath::addReachableNodes path_node   node [private]
 

Looks for every tile reachable walking by pos, and adds them to the open list.

Author:
Luxor

void cPath::addToClosedList path_node   node [private]
 

Adds an element to the closed list.

Author:
Luxor

void cPath::addToOpenList path_node   node [private]
 

Adds an element to the open list.

Author:
Luxor

void cPath::addToOpenList Location    pos,
path_node   parentNode,
UI32    cost = 10
[private]
 

Adds an element to the open list.

Author:
Luxor

path_node * cPath::create_node Location    pos,
path_node   parentNode,
UI32    cost
[private]
 

Author:
Luxor

void cPath::dropToClosedList path_node   node [private]
 

Insert an element in the closed list, and removes it from the open list if present.

Author:
Luxor

void cPath::exec  
 

Author:
Luxor

Location cPath::getFinalPos   [inline]
 

Location cPath::getNextPos  
 

Author:
Luxor

LOGICAL cPath::pathFound   [inline]
 

LOGICAL cPath::targetReached  
 

Author:
Luxor


Member Data Documentation

NODE_LIST cPath::closed_list [private]
 

path_node* cPath::currNode [private]
 

Location cPath::m_finalPos [private]
 

UI32 cPath::m_loops [private]
 

LOGICAL cPath::m_pathFound [private]
 

Location cPath::m_startPos [private]
 

path_node* cPath::nextNode [private]
 

queue<path_node> cPath::nodes_vector [private]
 

NODE_LIST cPath::open_list [private]
 

LOCATION_LIST cPath::path_list [private]
 

SERIAL cPath::pc_serial [private]
 


The documentation for this class was generated from the following files: SourceForge.net Logo