OccupiedCells and TargetableCells must return arrays, not just enumerables.

This allows callers to efficiently enumerate these returned collections without the allocation and overhead imposed by the IEnumerable interface. All implementations were already returning arrays, so this only required a signature change.
This commit is contained in:
RoosterDragon
2017-11-17 21:23:17 +00:00
committed by Pavel Penev
parent da036c5728
commit 62ab6ae6f1
10 changed files with 13 additions and 15 deletions

View File

@@ -160,7 +160,7 @@ namespace OpenRA.Mods.Common.Traits
}
public CPos TopLeft { get { return Location; } }
public IEnumerable<Pair<CPos, SubCell>> OccupiedCells() { return new[] { Pair.New(Location, SubCell.FullCell) }; }
public Pair<CPos, SubCell>[] OccupiedCells() { return new[] { Pair.New(Location, SubCell.FullCell) }; }
public WPos CenterPosition { get; private set; }