From b5b0f0c3b80c3482c4a560b5fab43b3440cacf09 Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Sun, 14 Jun 2026 11:59:15 +0200 Subject: [PATCH] perf(pathfinding): Skip redundant path-exists check in checkForAdjust --- Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 0d8003df21a..7296bb72239 100644 --- a/Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -5385,18 +5385,15 @@ Bool Pathfinder::checkForAdjust(Object *obj, const LocomotorSet& locomotorSet, B } if (checkDestination(obj, cellX, cellY, layer, iRadius, center)) { adjustCoordToCell(cellX, cellY, center, adjustDest, cellP->getLayer()); - Bool pathExists; Bool adjustedPathExists; if (obj->isKindOf(KINDOF_AIRCRAFT)) { - pathExists = true; adjustedPathExists = true; } else { - pathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), dest); - adjustedPathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), &adjustDest); - if (!pathExists) { - if (clientSafeQuickDoesPathExist( locomotorSet, dest, &adjustDest)) { - adjustedPathExists = true; - } + Bool pathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), dest); + if (!pathExists && clientSafeQuickDoesPathExist( locomotorSet, dest, &adjustDest)) { + adjustedPathExists = true; + } else { + adjustedPathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), &adjustDest); } } if ( adjustedPathExists ) {