diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 1fff327143..2be4fe1e40 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -203,7 +203,7 @@ namespace OpenRA.Traits { WPos CenterPosition { get; } CPos TopLeft { get; } - IEnumerable> OccupiedCells(); + Pair[] OccupiedCells(); } public static class IOccupySpaceExts diff --git a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs index 36a5637f9c..59bf683dff 100644 --- a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs +++ b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs @@ -136,7 +136,7 @@ namespace OpenRA.Mods.Cnc.Traits get { return Util.ApplyPercentageModifiers(Info.Speed, speedModifiers); } } - public IEnumerable> OccupiedCells() { return new[] { Pair.New(TopLeft, SubCell.FullCell) }; } + public Pair[] OccupiedCells() { return new[] { Pair.New(TopLeft, SubCell.FullCell) }; } WVec MoveStep(int facing) { diff --git a/OpenRA.Mods.Common/ShroudExts.cs b/OpenRA.Mods.Common/ShroudExts.cs index 3165809907..534f3dd5f0 100644 --- a/OpenRA.Mods.Common/ShroudExts.cs +++ b/OpenRA.Mods.Common/ShroudExts.cs @@ -15,11 +15,9 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common { - using OccupiedCells = IEnumerable>; - public static class ShroudExts { - public static bool AnyExplored(this Shroud shroud, OccupiedCells cells) + public static bool AnyExplored(this Shroud shroud, Pair[] cells) { // PERF: Avoid LINQ. foreach (var cell in cells) @@ -29,7 +27,7 @@ namespace OpenRA.Mods.Common return false; } - public static bool AnyVisible(this Shroud shroud, OccupiedCells cells) + public static bool AnyVisible(this Shroud shroud, Pair[] cells) { // PERF: Avoid LINQ. foreach (var cell in cells) diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 4c690dff42..40c39f963d 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -460,7 +460,7 @@ namespace OpenRA.Mods.Common.Traits get { return Util.ApplyPercentageModifiers(Info.Speed, speedModifiers); } } - public IEnumerable> OccupiedCells() { return NoCells; } + public Pair[] OccupiedCells() { return NoCells; } public WVec FlyStep(int facing) { diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index c20dae57aa..37f2b552b7 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -291,9 +291,9 @@ namespace OpenRA.Mods.Common.Traits SkipMakeAnimation = init.Contains(); } - public IEnumerable> OccupiedCells() { return occupiedCells; } + public Pair[] OccupiedCells() { return occupiedCells; } - IEnumerable> ITargetableCells.TargetableCells() { return targetableCells; } + Pair[] ITargetableCells.TargetableCells() { return targetableCells; } void INotifyCreated.Created(Actor self) { diff --git a/OpenRA.Mods.Common/Traits/Crates/Crate.cs b/OpenRA.Mods.Common/Traits/Crates/Crate.cs index 0619e6abb4..849cd7dd04 100644 --- a/OpenRA.Mods.Common/Traits/Crates/Crate.cs +++ b/OpenRA.Mods.Common/Traits/Crates/Crate.cs @@ -160,7 +160,7 @@ namespace OpenRA.Mods.Common.Traits } public CPos TopLeft { get { return Location; } } - public IEnumerable> OccupiedCells() { return new[] { Pair.New(Location, SubCell.FullCell) }; } + public Pair[] OccupiedCells() { return new[] { Pair.New(Location, SubCell.FullCell) }; } public WPos CenterPosition { get; private set; } diff --git a/OpenRA.Mods.Common/Traits/Husk.cs b/OpenRA.Mods.Common/Traits/Husk.cs index 88e76624bb..3965a44b18 100644 --- a/OpenRA.Mods.Common/Traits/Husk.cs +++ b/OpenRA.Mods.Common/Traits/Husk.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits self.QueueActivity(new Drag(self, CenterPosition, finalPosition, distance / dragSpeed)); } - public IEnumerable> OccupiedCells() { return new[] { Pair.New(TopLeft, SubCell.FullCell) }; } + public Pair[] OccupiedCells() { return new[] { Pair.New(TopLeft, SubCell.FullCell) }; } public bool IsLeavingCell(CPos location, SubCell subCell = SubCell.Any) { return false; } public SubCell GetValidSubCell(SubCell preferred = SubCell.Any) { return SubCell.FullCell; } public SubCell GetAvailableSubCell(CPos cell, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, bool checkTransientActors = true) diff --git a/OpenRA.Mods.Common/Traits/Immobile.cs b/OpenRA.Mods.Common/Traits/Immobile.cs index ad42cf145e..6dd84ff350 100644 --- a/OpenRA.Mods.Common/Traits/Immobile.cs +++ b/OpenRA.Mods.Common/Traits/Immobile.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits { [Sync] readonly CPos location; [Sync] readonly WPos position; - readonly IEnumerable> occupied; + readonly Pair[] occupied; public Immobile(ActorInitializer init, ImmobileInfo info) { @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits public CPos TopLeft { get { return location; } } public WPos CenterPosition { get { return position; } } - public IEnumerable> OccupiedCells() { return occupied; } + public Pair[] OccupiedCells() { return occupied; } void INotifyAddedToWorld.AddedToWorld(Actor self) { diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 19744bc329..4f4953a2c2 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -665,7 +665,7 @@ namespace OpenRA.Mods.Common.Traits public CPos TopLeft { get { return ToCell; } } - public IEnumerable> OccupiedCells() + public Pair[] OccupiedCells() { if (FromCell == ToCell) return new[] { Pair.New(FromCell, FromSubCell) }; diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index d15f15f790..e63781d448 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -383,7 +383,7 @@ namespace OpenRA.Mods.Common.Traits [RequireExplicitImplementation] public interface ITargetableCells { - IEnumerable> TargetableCells(); + Pair[] TargetableCells(); } [RequireExplicitImplementation]