Prevent movement pausing at invalid position.

This commit is contained in:
Paul Chote
2019-10-18 22:52:31 +01:00
committed by reaperrr
parent ae34410c80
commit 69970d42f3
8 changed files with 84 additions and 49 deletions

View File

@@ -141,6 +141,12 @@ namespace OpenRA.Mods.Common
}
}
public static bool AreAdjacentCells(CPos a, CPos b)
{
var offset = b - a;
return Math.Abs(offset.X) < 2 && Math.Abs(offset.Y) < 2;
}
public static IEnumerable<CPos> ExpandFootprint(IEnumerable<CPos> cells, bool allowDiagonal)
{
return cells.SelectMany(c => Neighbours(c, allowDiagonal)).Distinct();