Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
perf(pathfinder): skip a zone query checkForAdjust cannot need
Olcay Seygan3b06cdd58f49
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cppindex 2c803dd39..1776b45f2 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp@@ -5613,18 +5613,19 @@ 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;- }+ // The old form always ran both of the first two queries and then a third when the direct+ // path was blocked. The answer is (from->adjusted) OR (direct blocked AND dest->adjusted),+ // so when the second term already decides it the first query is never needed - two zone+ // walks instead of three on exactly the case this function exists to handle.+ Bool pathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), dest);+ if (!pathExists && clientSafeQuickDoesPathExist( locomotorSet, dest, &adjustDest)) {+ adjustedPathExists = true;+ } else {+ adjustedPathExists = clientSafeQuickDoesPathExist( locomotorSet, obj->getPosition(), &adjustDest);}}if ( adjustedPathExists ) {