PathGraph, skip closed cells early.

In path finding GetConnections considers connections to already closed cells and calculates the cost for them. The caller afterwards ignores them. These are 15% of all connections.
This commit is contained in:
Vapre
2021-07-16 01:41:17 +02:00
committed by abcdefg30
parent 24f64ae1a8
commit e201e410f4
2 changed files with 20 additions and 13 deletions

View File

@@ -72,10 +72,9 @@ namespace OpenRA.Mods.Common.Traits
return pos + new WVec(0, 0, height[cell] - pos.Z);
}
bool ValidTransitionCell(CPos cell, LocomotorInfo li)
bool ValidTransitionCell(CPos cell, SubterraneanLocomotorInfo sli)
{
var terrainType = map.GetTerrainInfo(cell).Type;
var sli = (SubterraneanLocomotorInfo)li;
if (!sli.SubterraneanTransitionTerrainTypes.Contains(terrainType) && sli.SubterraneanTransitionTerrainTypes.Any())
return false;