diff --git a/OpenRA.Mods.Common/Traits/Husk.cs b/OpenRA.Mods.Common/Traits/Husk.cs index 4497376623..433ea9973f 100644 --- a/OpenRA.Mods.Common/Traits/Husk.cs +++ b/OpenRA.Mods.Common/Traits/Husk.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits self.QueueActivity(new Drag(self, CenterPosition, finalPosition, distance / dragSpeed)); } - public IEnumerable> OccupiedCells() { yield return Pair.New(TopLeft, SubCell.FullCell); } + public IEnumerable> 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.RA/Traits/Crates/Crate.cs b/OpenRA.Mods.RA/Traits/Crates/Crate.cs index a2c99f9683..9c5aac236f 100644 --- a/OpenRA.Mods.RA/Traits/Crates/Crate.cs +++ b/OpenRA.Mods.RA/Traits/Crates/Crate.cs @@ -114,7 +114,7 @@ namespace OpenRA.Mods.RA.Traits } public CPos TopLeft { get { return Location; } } - public IEnumerable> OccupiedCells() { yield return Pair.New(Location, SubCell.FullCell); } + public IEnumerable> OccupiedCells() { return new[] { Pair.New(Location, SubCell.FullCell) }; } public WPos CenterPosition { get; private set; } public void SetPosition(Actor self, WPos pos) { SetPosition(self, self.World.Map.CellContaining(pos)); } diff --git a/OpenRA.Mods.RA/Traits/Mobile.cs b/OpenRA.Mods.RA/Traits/Mobile.cs index 18e2aab377..9012c2027a 100644 --- a/OpenRA.Mods.RA/Traits/Mobile.cs +++ b/OpenRA.Mods.RA/Traits/Mobile.cs @@ -486,14 +486,10 @@ namespace OpenRA.Mods.RA.Traits public IEnumerable> 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)