diff --git a/OpenRa.Game/Controller.cs b/OpenRa.Game/Controller.cs index a7bc9f90d9..bb05c67fd0 100644 --- a/OpenRa.Game/Controller.cs +++ b/OpenRa.Game/Controller.cs @@ -183,6 +183,7 @@ namespace OpenRa.Game case "Harvest": return Cursor.Attack; // TODO: special harvest cursor? case "PlaceBuilding": return Cursor.Default; case "Sell": return Cursor.Sell; + case "NoSell": return Cursor.SellBlocked; default: return null; } diff --git a/OpenRa.Game/Cursor.cs b/OpenRa.Game/Cursor.cs index 7c9dd60770..9c3d5b0f28 100644 --- a/OpenRa.Game/Cursor.cs +++ b/OpenRa.Game/Cursor.cs @@ -27,5 +27,6 @@ namespace OpenRa.Game public static Cursor Capture { get { return new Cursor("capture"); } } public static Cursor Heal { get { return new Cursor("heal"); } } public static Cursor Sell { get { return new Cursor("sell"); } } + public static Cursor SellBlocked { get { return new Cursor("sell-blocked"); } } } } diff --git a/OpenRa.Game/Orders/SellOrderGenerator.cs b/OpenRa.Game/Orders/SellOrderGenerator.cs index 2734438ce0..aac3baf3b5 100644 --- a/OpenRa.Game/Orders/SellOrderGenerator.cs +++ b/OpenRa.Game/Orders/SellOrderGenerator.cs @@ -11,18 +11,25 @@ namespace OpenRa.Game.Orders { public IEnumerable Order(int2 xy, MouseInput mi) { + if (!mi.IsFake && mi.Button == MouseButton.Right) + { + Game.controller.CancelInputMode(); + yield break; + } + var loc = mi.Location + Game.viewport.Location; var underCursor = Game.FindUnits(loc, loc) .Where(a => a.Owner == Game.LocalPlayer && a.traits.Contains() && a.Info.Selectable).FirstOrDefault(); - if (underCursor == null) - yield break; + var building = underCursor != null ? underCursor.Info as BuildingInfo : null; - var building = underCursor.traits.Get(); - if (building.unitInfo.Unsellable) + if (building == null || building.Unsellable) + { + yield return new Order("NoSell", Game.LocalPlayer.PlayerActor, null, int2.Zero, null); yield break; + } yield return new Order("Sell", underCursor, null, int2.Zero, null); } diff --git a/sequences.xml b/sequences.xml index 9f438213cf..bc58377d4d 100644 --- a/sequences.xml +++ b/sequences.xml @@ -372,14 +372,14 @@ - + - +