* @brief insert pPath into the frontier (keeping the frontier sorted by total distance) */
| 285 | * @brief insert pPath into the frontier (keeping the frontier sorted by total distance) |
| 286 | */ |
| 287 | void path_next_node(PATHNODE *pPath) |
| 288 | { |
| 289 | PATHNODE *next, *current; |
| 290 | int f; |
| 291 | |
| 292 | next = path_2_nodes; |
| 293 | if (!path_2_nodes->NextNode) { |
| 294 | path_2_nodes->NextNode = pPath; |
| 295 | } else { |
| 296 | current = path_2_nodes; |
| 297 | next = path_2_nodes->NextNode; |
| 298 | f = pPath->f; |
| 299 | while (next && next->f < f) { |
| 300 | current = next; |
| 301 | next = next->NextNode; |
| 302 | } |
| 303 | pPath->NextNode = next; |
| 304 | current->NextNode = pPath; |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * @brief update all path costs using depth-first search starting at pPath |