Browse Source

Clean up path_next_node.

pull/133/head
Sergey Semushin 7 years ago committed by Anders Jenbo
parent
commit
74da7a9e7e
  1. 24
      Source/path.cpp

24
Source/path.cpp

@ -273,21 +273,23 @@ PATHNODE *path_get_node2(int dx, int dy)
* distance) */ * distance) */
void path_next_node(PATHNODE *pPath) void path_next_node(PATHNODE *pPath)
{ {
PATHNODE *current; // edx PATHNODE *next, *current;
PATHNODE *next; // eax int f;
current = path_2_nodes; next = path_2_nodes;
next = path_2_nodes->NextNode; if (path_2_nodes->NextNode) {
if (next != NULL) { current = path_2_nodes;
do { next = path_2_nodes->NextNode;
if (next->f >= pPath->f) f = pPath->f;
break; while (next && next->f < f) {
current = next; current = next;
next = next->NextNode; next = next->NextNode;
} while (next != NULL); }
pPath->NextNode = next; pPath->NextNode = next;
current->NextNode = pPath;
} else {
path_2_nodes->NextNode = pPath;
} }
current->NextNode = pPath;
} }
/* update all path costs using depth-first search starting at pPath */ /* update all path costs using depth-first search starting at pPath */

Loading…
Cancel
Save