Adonthell
0.4
|
A* pathfinding algorithm implementation class. More...
#include <path.h>
Classes | |
struct | area_coord |
(x, y) coordinates of a point on a submap. More... | |
Public Member Functions | |
void | clear () |
Totally clears the path. More... | |
bool | calculate () |
Tries to find the shortest path possible between the start point and the goal point. More... | |
u_int16 | nbr_moves () const |
Returns the number of moves between start and goal. More... | |
u_int16 | get_move (u_int16 nbr) const |
Returns the move to perform when at position nbr. More... | |
s_int8 | get_state (igzstream &file) |
Restore the path's state from an opened file. More... | |
s_int8 | put_state (ogzstream &file) const |
Saves the path's state into an opened file. More... | |
Public Attributes | |
landmap * | refmap |
Landmap where the pathfinding will occur. More... | |
u_int16 | submap |
Submap where the pathfinding will occur. More... | |
u_int16 | dir |
Direction to face once the goal is reached. More... | |
area_coord | start |
Start point. More... | |
area_coord | goal |
Goal point. More... | |
A* pathfinding algorithm implementation class.
This class calculates the shortest way from a begin point to a goal point on a landmap using the A* algorithm. It stores a list of directions that when followed lead from the start to the goal.
This class is particularly well designed for mapcharacters, who will often need to walk from one point to another.
bool path::calculate | ( | ) |
|
inline |
landmap* path::refmap |
u_int16 path::dir |
area_coord path::start |
area_coord path::goal |