Allow the default value of a CellInfo to be an Unvisited location.
In CellInfoLayerPool, instead of having to store a layer with the default values, we know we can just clear the pooled layer in order to reset it. This saves on memory, and also makes resetting marginally faster. In PathSearch, we need to amend a check to ensure a cell info is not Unvisited before we check on its cost.
This commit is contained in:
@@ -119,7 +119,8 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
var neighborCell = Graph[neighborCPos];
|
||||
|
||||
// Cost is even higher; next direction:
|
||||
if (neighborCell.Status == CellStatus.Closed || gCost >= neighborCell.CostSoFar)
|
||||
if (neighborCell.Status == CellStatus.Closed ||
|
||||
(neighborCell.Status == CellStatus.Open && gCost >= neighborCell.CostSoFar))
|
||||
continue;
|
||||
|
||||
// Now we may seriously consider this direction using heuristics. If the cell has
|
||||
|
||||
Reference in New Issue
Block a user