From 740701089f492c74cfdedda8a9f43a5e46ef6bfc Mon Sep 17 00:00:00 2001 From: Tim Felgentreff <timfelgentreff@gmail.com> Date: Tue, 15 Feb 2022 22:32:07 +0100 Subject: [PATCH] Revert "improve astar cleanup performance. thanks @Andrettin" This reverts commit c81abe99a2e7c0fe578b8bbcf7fc55c1e7d64e5c. --- src/pathfinder/astar.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pathfinder/astar.cpp b/src/pathfinder/astar.cpp index 981b27bd9..7932fdcea 100644 --- a/src/pathfinder/astar.cpp +++ b/src/pathfinder/astar.cpp @@ -307,19 +307,16 @@ static void AStarPrepare() /** ** Clean up A* */ -static void CostMoveToCacheCleanUp(); static void AStarCleanUp() { ProfileBegin("AStarCleanUp"); if (CloseSetSize >= Threshold) { AStarPrepare(); - CostMoveToCacheCleanUp(); } else { for (int i = 0; i < CloseSetSize; ++i) { AStarMatrix[CloseSet[i]].CostFromStart = 0; AStarMatrix[CloseSet[i]].InGoal = 0; - CostMoveToCache[CloseSet[i]] = CacheNotSet; } } ProfileEnd("AStarCleanUp"); @@ -939,6 +936,7 @@ int AStarFindPath(const Vec2i &startPos, const Vec2i &goalPos, int gw, int gh, // Initialize AStarCleanUp(); + CostMoveToCacheCleanUp(); OpenSetSize = 0; CloseSetSize = 0;