26 #include "../../stdafx.h"
27 #include "../../core/alloc_func.hpp"
30 #include "../../safeguards.h"
50 PathNode *new_node = MallocT<PathNode>(1);
90 new_node->path.
parent = parent;
91 new_node->path.node = *node;
103 int new_f, new_g, new_h;
111 new_g = this->CalculateG(
this, current, parent);
122 new_h = this->CalculateH(
this, current, parent);
127 new_f = new_g + new_h;
137 if (new_g > check->g)
return;
141 check->path.
parent = closedlist_parent;
143 for (i = 0; i <
lengthof(current->user_data); i++) {
144 check->path.node.user_data[i] = current->user_data[i];
150 this->
OpenListAdd(closedlist_parent, current, new_f, new_g);
174 if (this->FoundEndNode != NULL) {
175 this->FoundEndNode(
this, current);
185 this->GetNeighbours(
this, current);
188 for (i = 0; i < this->num_neighbours; i++) {
190 this->
CheckTile(&this->neighbours[i], current);
216 printf(
"[AyStar] Memory free'd\n");
234 printf(
"[AyStar] Cleared AyStar\n");
285 printf(
"[AyStar] Starting A* Algorithm from node (%d, %d, %d)\n",
286 TileX(start_node->tile),
TileY(start_node->tile), start_node->direction);