Improve support for picking a valid actor spawn cell.
This commit is contained in:
@@ -75,6 +75,7 @@ namespace OpenRA
|
||||
[FieldFromYamlKey] public readonly int value = 0;
|
||||
public SubCellInit() { }
|
||||
public SubCellInit(int init) { value = init; }
|
||||
public SubCellInit(SubCell init) { value = (int)init; }
|
||||
public SubCell Value(World world) { return (SubCell)value; }
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user