no more local accumulator crap in FindPath

This commit is contained in:
Chris Forbes
2009-11-18 21:34:25 +13:00
parent 9a2f2f1cd7
commit d6d1846ee3

View File

@@ -77,24 +77,18 @@ namespace OpenRa.Game
public List<int2> FindPath( PathSearch search ) public List<int2> FindPath( PathSearch search )
{ {
int nodesExpanded = 0;
using (new PerfSample("find_path_inner")) using (new PerfSample("find_path_inner"))
{ {
while (!search.queue.Empty) while (!search.queue.Empty)
{ {
var p = search.Expand( passableCost ); var p = search.Expand( passableCost );
PerfHistory.Increment("nodes_expanded", .01);
if (search.heuristic(p) == 0) if (search.heuristic(p) == 0)
{
PerfHistory.Increment("nodes_expanded", nodesExpanded * .01);
return MakePath(search.cellInfo, p); return MakePath(search.cellInfo, p);
}
nodesExpanded++;
} }
// no path exists // no path exists
PerfHistory.Increment("nodes_expanded", nodesExpanded * .01);
return new List<int2>(); return new List<int2>();
} }
} }