19 #include "../track_func.h"
21 #include "../misc/hashtable.hpp"
22 #include "../misc/binaryheap.hpp"
23 #include "../misc/dbg_helpers.h"
47 bool CheckIgnoreFirstTile(
const PathNode *node);
129 std::vector<AyStarNode> neighbours;
int32_t AyStar_CalculateG(AyStar *aystar, AyStarNode *current, PathNode *parent)
Calculate the G-value for the AyStar algorithm.
static const int AYSTAR_INVALID_NODE
Item is not valid (for example, not walkable).
int32_t AyStar_CalculateH(AyStar *aystar, AyStarNode *current, PathNode *parent)
Calculate the H-value for the AyStar algorithm.
AystarStatus
Return status of AyStar methods.
@ AYSTAR_DONE
Not an end-tile, or wrong direction.
@ AYSTAR_LIMIT_REACHED
The AyStar::max_search_nodes limit has been reached, aborting search.
@ AYSTAR_FOUND_END_NODE
An end node was found.
@ AYSTAR_NO_PATH
No path to the goal was found.
@ AYSTAR_STILL_BUSY
Some checking was done, but no path found yet, and there are still items left to try.
@ AYSTAR_EMPTY_OPENLIST
All items are tested, and no path has been found.
void AyStar_GetNeighbours(AyStar *aystar, PathNode *current)
This function requests the tiles around the current tile and put them in #neighbours.
static const int AYSTAR_DEF_MAX_SEARCH_NODES
Reference limit for AyStar::max_search_nodes.
int32_t AyStar_EndNodeCheck(const AyStar *aystar, const PathNode *current)
Check whether the end-tile is found.
void AyStar_FoundEndNode(AyStar *aystar, PathNode *current)
If the End Node is found, this function is called.
List of nodes used for the A-star pathfinder.
AyStar search algorithm struct.
int max_search_nodes
The maximum number of nodes that will be expanded, 0 = infinite.
void OpenListAdd(PathNode *parent, const AyStarNode *node, int f, int g)
Adds a node to the open list.
int Loop()
This function is the core of AyStar.
int max_path_cost
If the g-value goes over this number, it stops searching, 0 = infinite.
void CheckTile(AyStarNode *current, PathNode *parent)
Checks one tile and calculate its f-value.
void AddStartNode(AyStarNode *start_node, int g)
Adds a node from where to start an algorithm.
int Main()
This is the function you call to run AyStar.
uint8_t loops_per_tick
How many loops are there called before Main() gives control back to the caller. 0 = until done.
Node in the pathfinder's graph.