Skip to content

Commit d37051f

Browse files
perf(pathfinding): Skip redundant path-exists check in Pathfinder::checkForAdjust() (#2791)
1 parent 61ef3c6 commit d37051f

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5385,18 +5385,15 @@ Bool Pathfinder::checkForAdjust(Object *obj, const LocomotorSet& locomotorSet, B
53855385
}
53865386
if (checkDestination(obj, cellX, cellY, layer, iRadius, center)) {
53875387
adjustCoordToCell(cellX, cellY, center, adjustDest, cellP->getLayer());
5388-
Bool pathExists;
53895388
Bool adjustedPathExists;
53905389
if (obj->isKindOf(KINDOF_AIRCRAFT)) {
5391-
pathExists = true;
53925390
adjustedPathExists = true;
53935391
} else {
5394-
pathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), dest);
5395-
adjustedPathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), &adjustDest);
5396-
if (!pathExists) {
5397-
if (clientSafeQuickDoesPathExist( locomotorSet, dest, &adjustDest)) {
5398-
adjustedPathExists = true;
5399-
}
5392+
Bool pathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), dest);
5393+
if (!pathExists && clientSafeQuickDoesPathExist( locomotorSet, dest, &adjustDest)) {
5394+
adjustedPathExists = true;
5395+
} else {
5396+
adjustedPathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), &adjustDest);
54005397
}
54015398
}
54025399
if ( adjustedPathExists ) {

0 commit comments

Comments
 (0)