Add a SubCell field to UIM. Allow UIM to query for units by subcell.

This commit is contained in:
Paul Chote
2011-02-02 21:27:32 +13:00
parent 451e06190f
commit 4b3c6cc62a
16 changed files with 60 additions and 29 deletions

View File

@@ -271,13 +271,17 @@ namespace OpenRA.Mods.RA.Move
public int2 TopLeft { get { return toCell; } }
public IEnumerable<int2> OccupiedCells()
public IEnumerable<Pair<int2, SubCell>> OccupiedCells()
{
return (fromCell == toCell)
? new[] { fromCell }
: CanEnterCell(toCell)
? new[] { toCell }
: new[] { fromCell, toCell };
if (fromCell == toCell)
yield return Pair.New(fromCell, SubCell.FullCell);
else if (CanEnterCell(toCell))
yield return Pair.New(toCell, SubCell.FullCell);
else
{
yield return Pair.New(fromCell, SubCell.FullCell);
yield return Pair.New(toCell, SubCell.FullCell);
}
}
public bool CanEnterCell(int2 p)