diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index bf5a6c7f23..b5552b7e1c 100755 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -92,8 +92,7 @@ namespace OpenRa if (!World.Map.IsInMap(xy.X, xy.Y)) return null; - var loc = mi.Location + Game.viewport.Location; - var underCursor = World.FindUnits(loc, loc).FirstOrDefault(); + var underCursor = World.FindUnitsAtMouse(mi.Location).FirstOrDefault(); if (underCursor != null && !underCursor.traits.Contains()) underCursor = null; diff --git a/OpenRa.Game/Orders/PowerDownOrderGenerator.cs b/OpenRa.Game/Orders/PowerDownOrderGenerator.cs index a8f40b7309..130dd9307b 100644 --- a/OpenRa.Game/Orders/PowerDownOrderGenerator.cs +++ b/OpenRa.Game/Orders/PowerDownOrderGenerator.cs @@ -21,8 +21,7 @@ namespace OpenRa.Orders { if (mi.Button == MouseButton.Left) { - var loc = mi.Location + Game.viewport.Location; - var underCursor = world.FindUnits(loc, loc) + var underCursor = world.FindUnitsAtMouse(mi.Location) .Where(a => a.Owner == world.LocalPlayer && a.traits.Contains()) .FirstOrDefault(); diff --git a/OpenRa.Game/Orders/RepairOrderGenerator.cs b/OpenRa.Game/Orders/RepairOrderGenerator.cs index bc7144cbb1..0dde392e40 100644 --- a/OpenRa.Game/Orders/RepairOrderGenerator.cs +++ b/OpenRa.Game/Orders/RepairOrderGenerator.cs @@ -21,8 +21,7 @@ namespace OpenRa.Orders { if (mi.Button == MouseButton.Left) { - var loc = mi.Location + Game.viewport.Location; - var underCursor = world.FindUnits(loc, loc) + var underCursor = world.FindUnitsAtMouse(mi.Location) .Where(a => a.Owner == world.LocalPlayer && a.traits.Contains() && a.traits.Contains()).FirstOrDefault(); diff --git a/OpenRa.Game/Orders/SellOrderGenerator.cs b/OpenRa.Game/Orders/SellOrderGenerator.cs index 347ac977ad..895810ef9e 100644 --- a/OpenRa.Game/Orders/SellOrderGenerator.cs +++ b/OpenRa.Game/Orders/SellOrderGenerator.cs @@ -21,8 +21,7 @@ namespace OpenRa.Orders { if (mi.Button == MouseButton.Left) { - var loc = mi.Location + Game.viewport.Location; - var underCursor = world.FindUnits(loc, loc) + var underCursor = world.FindUnitsAtMouse(mi.Location) .Where(a => a.Owner == world.LocalPlayer && a.traits.Contains() && a.traits.Contains()).FirstOrDefault(); diff --git a/OpenRa.Game/Traits/ChronoshiftPower.cs b/OpenRa.Game/Traits/ChronoshiftPower.cs index 1f21c9193f..766a87bdcf 100644 --- a/OpenRa.Game/Traits/ChronoshiftPower.cs +++ b/OpenRa.Game/Traits/ChronoshiftPower.cs @@ -87,8 +87,7 @@ namespace OpenRa.Traits { if (mi.Button == MouseButton.Left) { - var loc = mi.Location + Game.viewport.Location; - var underCursor = world.FindUnits(loc, loc) + var underCursor = world.FindUnitsAtMouse(mi.Location) .Where(a => a.Owner != null && a.traits.Contains() && a.traits.Contains()).FirstOrDefault(); diff --git a/OpenRa.Game/Traits/CrateSpawnPower.cs b/OpenRa.Game/Traits/CrateSpawnPower.cs index 244d71c132..957038560b 100644 --- a/OpenRa.Game/Traits/CrateSpawnPower.cs +++ b/OpenRa.Game/Traits/CrateSpawnPower.cs @@ -51,9 +51,7 @@ namespace OpenRa.Traits { if (mi.Button == MouseButton.Left) { - var loc = mi.Location + Game.viewport.Location; - var underCursor = world.FindUnits(loc, loc).FirstOrDefault(); - + var underCursor = world.FindUnitsAtMouse(mi.Location).FirstOrDefault(); if (underCursor == null) yield return new Order("SpawnCrate", world.LocalPlayer.PlayerActor, xy); }