Skip to content

Commit

Permalink
Revert "Reusing same predicate for path query"
Browse files Browse the repository at this point in the history
This reverts commit e5728ee.
  • Loading branch information
past-due committed Oct 28, 2023
1 parent a9f8d74 commit 98926df
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/astar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,6 @@ struct NearestSearchPredicate {
unsigned estimateCost(const PathCoord& pos) const {
return fpathGoodEstimate(pos, goal);
}

void clear() {
nearestCoord = {0, 0};
nearestDist = 0xFFFFFFFF;
}
};

/// Runs A* wave propagation for 8 neighbors pattern.
Expand Down Expand Up @@ -527,8 +522,6 @@ ASR_RETVAL fpathAStarRoute(MOVE_CONTROL *psMove, PATHJOB *psJob)
const bool isDroidSelected = (psDroid && psDroid->selected);
#endif

NearestSearchPredicate pred(tileDest);

PathCoord endCoord; // Either nearest coord (mustReverse = true) or orig (mustReverse = false).

std::list<PathfindContext>::iterator contextIterator = fpathContexts.begin();
Expand Down Expand Up @@ -556,7 +549,7 @@ ASR_RETVAL fpathAStarRoute(MOVE_CONTROL *psMove, PATHJOB *psJob)
{
// Need to find the path from orig to dest, continue previous exploration.
fpathAStarReestimate(pfContext, tileOrig);
pred.clear();
NearestSearchPredicate pred(tileDest);
if (!fpathAStarExplore(pfContext, pred)) {
syncDebug("fpathAStarRoute (%d,%d) to (%d,%d) - wave collapsed. Nearest=%d", tileOrig.x, tileOrig.y, tileDest.x, tileDest.y, pred.nearestDist);
}
Expand Down Expand Up @@ -587,7 +580,7 @@ ASR_RETVAL fpathAStarRoute(MOVE_CONTROL *psMove, PATHJOB *psJob)
// We will be searching from orig to dest, since we don't know where the nearest reachable tile to dest is.
fpathInitContext(pfContext, psJob->blockingMap, tileOrig, tileOrig, tileDest, dstIgnore);

pred.clear();
NearestSearchPredicate pred(tileDest);
if (!fpathAStarExplore(pfContext, pred)) {
#if DEBUG
if (isDroidSelected) {
Expand Down

0 comments on commit 98926df

Please sign in to comment.