Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8139,19 +8139,25 @@ struct TightenPathStruct
/*static*/ Int Pathfinder::tightenPathCallback(Pathfinder* pathfinder, PathfindCell* from, PathfindCell* to, Int to_x, Int to_y, void* userData)
{
TightenPathStruct* d = (TightenPathStruct*)userData;
if (from == nullptr || to==nullptr) return 0;
if (from == nullptr || to==nullptr) return 0; // failure
if (d->layer != to->getLayer()) {
return 0; // abort.
return 0; // failure
}
Coord3D pos;

// TheSuperHackers @bugfix Caball009 27/02/2026 This was originally uninitialized.
// The uninitialized values that retail uses here are usually close to zero as long as foundDest == false, otherwise it uses the values of destPos.
Coord3D pos = d->destPos;
if (!d->foundDest)
pos.zero();

if (!TheAI->pathfinder()->checkForAdjust(d->obj, *d->locomotorSet, true, to_x, to_y, to->getLayer(), d->radius, d->center, &pos, nullptr))
{
return 0; // bail early
return 0; // failure
}
d->foundDest = true;
d->destPos = pos;

return 0; // keep going
return 0; // success but continue
}

/* Returns the cost, which is in the same units as coord3d distance. */
Expand Down
Loading