Improve support for picking a valid actor spawn cell.

This commit is contained in:
Paul Chote
2013-07-12 20:21:21 +12:00
parent 6bf783e674
commit 2091a386fb
3 changed files with 18 additions and 2 deletions

View File

@@ -64,6 +64,16 @@ namespace OpenRA
SubCell.BottomLeft, SubCell.BottomRight }.Any(b => !AnyUnitsAt(a,b));
}
public SubCell? FreeSubCell(CPos a)
{
if (!HasFreeSubCell(a))
return null;
return new[]{ SubCell.TopLeft, SubCell.TopRight, SubCell.Center,
SubCell.BottomLeft, SubCell.BottomRight }.First(b => !AnyUnitsAt(a,b));
}
public bool AnyUnitsAt(CPos a)
{
return influence[ a.X, a.Y ] != null;