diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index df757835b1..4984d50eb3 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -165,6 +165,7 @@ namespace OpenRA.Traits public static Target FromActor(Actor a) { return new Target { actor = a, valid = true }; } public static Target FromPos(float2 p) { return new Target { pos = p, valid = true }; } + public static Target FromCell(int2 c) { return new Target { pos = Util.CenterOfCell(c), valid = true }; } public static Target FromOrder(Order o) { return o.TargetActor != null ? Target.FromActor(o.TargetActor) : Target.FromPos(o.TargetLocation); } public static readonly Target None = new Target(); diff --git a/OpenRA.Mods.Cnc/Effects/IonCannon.cs b/OpenRA.Mods.Cnc/Effects/IonCannon.cs index 703aae6572..0d86c4b234 100644 --- a/OpenRA.Mods.Cnc/Effects/IonCannon.cs +++ b/OpenRA.Mods.Cnc/Effects/IonCannon.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.Effects public IonCannon(Actor firedBy, World world, int2 location) { this.firedBy = firedBy; - target = Target.FromPos(OpenRA.Traits.Util.CenterOfCell(location)); + target = Target.FromCell(location); anim = new Animation("ionsfx"); anim.PlayThen("idle", () => Finish(world)); } diff --git a/OpenRA.Mods.RA/AttackBase.cs b/OpenRA.Mods.RA/AttackBase.cs index ec4e0f2096..05f1943a18 100755 --- a/OpenRA.Mods.RA/AttackBase.cs +++ b/OpenRA.Mods.RA/AttackBase.cs @@ -208,7 +208,7 @@ namespace OpenRA.Mods.RA if (mi.Button == MouseButton.Left) return null; if (self == underCursor) return null; - var target = underCursor == null ? Target.FromPos(Util.CenterOfCell(xy)) : Target.FromActor(underCursor); + var target = underCursor == null ? Target.FromCell(xy) : Target.FromActor(underCursor); var isHeal = self.GetPrimaryWeapon().Warheads.First().Damage < 0; var forceFire = mi.Modifiers.HasModifier(Modifiers.Ctrl);