Merge pull request #7230 from RoosterDragon/occupied-cells-arrays

Make OccupiedCells implementations return arrays.
This commit is contained in:
Matthias Mailänder
2015-01-02 17:38:56 +01:00
3 changed files with 6 additions and 10 deletions

View File

@@ -486,14 +486,10 @@ namespace OpenRA.Mods.RA.Traits
public IEnumerable<Pair<CPos, SubCell>> OccupiedCells()
{
if (fromCell == toCell)
yield return Pair.New(fromCell, fromSubCell);
else if (CanEnterCell(toCell))
yield return Pair.New(toCell, toSubCell);
else
{
yield return Pair.New(fromCell, fromSubCell);
yield return Pair.New(toCell, toSubCell);
}
return new[] { Pair.New(fromCell, fromSubCell) };
if (CanEnterCell(toCell))
return new[] { Pair.New(toCell, toSubCell) };
return new[] { Pair.New(fromCell, fromSubCell), Pair.New(toCell, toSubCell) };
}
public bool IsLeavingCell(CPos location, SubCell subCell = SubCell.Any)