PathGraph, skip closed cells early. Fix #19579.

This commit is contained in:
Vapre
2021-08-03 23:29:35 +02:00
committed by abcdefg30
parent 8fc042fed1
commit 35e9fade06

View File

@@ -147,13 +147,10 @@ namespace OpenRA.Mods.Common.Pathfinder
{
var dir = directions[i];
var neighbor = position + dir;
var movementCost = GetCostToNode(neighbor, dir);
// PERF: Skip closed cells already, 15% of all cells
if (info[neighbor].Status == CellStatus.Closed)
continue;
var movementCost = GetCostToNode(neighbor, dir);
if (movementCost != CostForInvalidCell)
if (movementCost != CostForInvalidCell && info[neighbor].Status != CellStatus.Closed)
validNeighbors.Add(new GraphConnection(neighbor, movementCost));
}