MCPcopy Create free account
hub / github.com/diasurgical/devilution / path_set_coords

Function path_set_coords

Source/path.cpp:311–335  ·  view source on GitHub ↗

* @brief update all path costs using depth-first search starting at pPath */

Source from the content-addressed store, hash-verified

309 * @brief update all path costs using depth-first search starting at pPath
310 */
311void path_set_coords(PATHNODE *pPath)
312{
313 PATHNODE *PathOld;
314 PATHNODE *PathAct;
315 int i;
316
317 path_push_active_step(pPath);
318 while (gdwCurPathStep) {
319 PathOld = path_pop_active_step();
320 for (i = 0; i < 8; i++) {
321 PathAct = PathOld->Child[i];
322 if (PathAct == NULL)
323 break;
324
325 if (PathOld->g + path_check_equal(PathOld, PathAct->x, PathAct->y) < PathAct->g) {
326 if (path_solid_pieces(PathOld, PathAct->x, PathAct->y)) {
327 PathAct->Parent = PathOld;
328 PathAct->g = PathOld->g + path_check_equal(PathOld, PathAct->x, PathAct->y);
329 PathAct->f = PathAct->g + PathAct->h;
330 path_push_active_step(PathAct);
331 }
332 }
333 }
334 }
335}
336
337/**
338 * @brief push pPath onto the pnode_tblptr stack

Callers 1

path_parent_pathFunction · 0.85

Calls 4

path_push_active_stepFunction · 0.85
path_pop_active_stepFunction · 0.85
path_check_equalFunction · 0.85
path_solid_piecesFunction · 0.85

Tested by

no test coverage detected