Revert "improve astar cleanup performance. thanks @Andrettin"

This reverts commit c81abe99a2.
This commit is contained in:
Tim Felgentreff 2022-02-15 22:32:07 +01:00
parent e4f2898b91
commit 740701089f

View file

@ -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;