#include <pathfinderastartile8dircached.h>
Public Member Functions | |
| const PathResult | FindPath (const std::pair< long, long > &start, const std::pair< long, long > &goal, std::vector< std::pair< long, long > > &finalpath, MOVECOST &movecost, DESTCOST &destinationcost) |
| Finds a path from one x,y position to another. | |
| const PathResult | FindPath (const std::pair< long, long > &start, const std::pair< long, long > &goal, std::vector< std::pair< long, long > > &finalpath, MOVECOST &movecost, MOVEBLOCKED &moveblocked, DESTCOST &destinationcost) |
| Finds a path from one x,y position to another. | |
| void | SetMapWidth (const long width) |
| Sets the map width. | |
| void | ClearCache () |
| Clears the entire cache. | |
| void | ClearCachePosition (const std::pair< long, long > &pos) |
| Clears one cache element. | |
This is an A * path finder for tile based games where movement is possible in 8 directions surrounding each tile. The movement costs from state to state are cached to maximize performance. If state change costs can change frequently, you should use the non-cached version of this class.
| MOVECOST | A functor implementing IMoveCost | |
| DESTCOST | A functor implementing IDestinationCost | |
| MOVEBLOCKED | A functor implementing IMoveBlocked | |
| COSTTYPE | The cost type of moving from state to state, typically a float or double |
| void Pathfinder::AStarTile8DirCached< MOVECOST, DESTCOST, MOVEBLOCKED, COSTTYPE >::ClearCachePosition | ( | const std::pair< long, long > & | pos | ) | [inline] |
Clears one cache element.
Call this method when the cost of reaching a state has changed.
| pos | The position of the cache to clear |
| const PathResult Pathfinder::AStarTile8DirCached< MOVECOST, DESTCOST, MOVEBLOCKED, COSTTYPE >::FindPath | ( | const std::pair< long, long > & | start, | |
| const std::pair< long, long > & | goal, | |||
| std::vector< std::pair< long, long > > & | finalpath, | |||
| MOVECOST & | movecost, | |||
| MOVEBLOCKED & | moveblocked, | |||
| DESTCOST & | destinationcost | |||
| ) | [inline] |
Finds a path from one x,y position to another.
This method finds a path from one state to another and takes into consideration that any of the surrounding tiles may not be reachable. This method will block until a path from the start to the goal is found or all reachable nodes have been checked without finding a path.
| start | The starting x,y position | |
| goal | The goal x,y position | |
| [out] | finalpath | A vector of x,y positions from the starting position to the goal position |
| movecost | A functor implementing IMoveCost | |
| moveblocked | A functor implementing IMoveBlocked | |
| destinationcost | A functor implementing IDestinationCost |
| const PathResult Pathfinder::AStarTile8DirCached< MOVECOST, DESTCOST, MOVEBLOCKED, COSTTYPE >::FindPath | ( | const std::pair< long, long > & | start, | |
| const std::pair< long, long > & | goal, | |||
| std::vector< std::pair< long, long > > & | finalpath, | |||
| MOVECOST & | movecost, | |||
| DESTCOST & | destinationcost | |||
| ) | [inline] |
Finds a path from one x,y position to another.
This method finds a path from one state to another and assumes that all 8 surrounding tiles are always reachable. This method will block until a path from the start to the goal is found or all reachable nodes have been checked without finding a path.
| start | The starting x,y position | |
| goal | The goal x,y position | |
| [out] | finalpath | A vector of x,y positions from the starting position to the goal position |
| movecost | A functor implementing IMoveCost | |
| destinationcost | A functor implementing IDestinationCost |
| void Pathfinder::AStarTile8DirCached< MOVECOST, DESTCOST, MOVEBLOCKED, COSTTYPE >::SetMapWidth | ( | const long | width | ) | [inline] |
Sets the map width.
You must call this method with the width of the map before performing any path finding
| width | The width of the map |
1.5.7.1