diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index 7ca610dd0d..1da74bdeec 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -9,6 +9,8 @@ */ #endregion +using System.Collections.Generic; +using System.Linq; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits @@ -191,5 +193,17 @@ namespace OpenRA.Mods.Common.Traits var speech = isAllied ? Info.LaunchSpeechNotification : Info.IncomingSpeechNotification; Game.Sound.PlayNotification(Self.World.Map.Rules, toPlayer, "Speech", speech, toPlayer.Faction.InternalName); } + + public IEnumerable CellsMatching(CPos location, string footprint, CVec dimensions) + { + var index = 0; + var fp = footprint.Where(c => !char.IsWhiteSpace(c)).ToArray(); + var x = location.X - (dimensions.X - 1) / 2; + var y = location.Y - (dimensions.Y - 1) / 2; + for (var j = 0; j < dimensions.Y; j++) + for (var i = 0; i < dimensions.X; i++) + if (fp[index++] == 'x') + yield return new CPos(x + i, y + j); + } } }