New types for cell and pixel coordinate position/vectors.

This commit is contained in:
James Dunne
2012-06-20 23:22:27 -05:00
parent 0b98a8ce5e
commit 9c49143534
162 changed files with 1291 additions and 865 deletions

View File

@@ -60,17 +60,17 @@ namespace OpenRA.Mods.RA.Crates
base.Activate(collector);
}
IEnumerable<int2> GetSuitableCells(int2 near)
IEnumerable<CPos> GetSuitableCells(CPos near)
{
var mi = Rules.Info[Info.Unit].Traits.Get<MobileInfo>();
for (var i = -1; i < 2; i++)
for (var j = -1; j < 2; j++)
if (mi.CanEnterCell(self.World, self.Owner, near + new int2(i, j), null, true))
yield return near + new int2(i, j);
if (mi.CanEnterCell(self.World, self.Owner, near + new CVec(i, j), null, true))
yield return near + new CVec(i, j);
}
int2? ChooseEmptyCellNear(Actor a)
CPos? ChooseEmptyCellNear(Actor a)
{
var possibleCells = GetSuitableCells(a.Location).ToArray();
if (possibleCells.Length == 0)