From 27e47cd0668b212a629ad67fc8b50e30a47646df Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 2 Jan 2010 12:40:09 +1300 Subject: [PATCH] more wiring for selling --- OpenRa.Game/Controller.cs | 1 + OpenRa.Game/Cursor.cs | 1 + OpenRa.Game/Traits/Building.cs | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/OpenRa.Game/Controller.cs b/OpenRa.Game/Controller.cs index db21e2d006..a7bc9f90d9 100644 --- a/OpenRa.Game/Controller.cs +++ b/OpenRa.Game/Controller.cs @@ -182,6 +182,7 @@ namespace OpenRa.Game case "Capture": return Cursor.Capture; case "Harvest": return Cursor.Attack; // TODO: special harvest cursor? case "PlaceBuilding": return Cursor.Default; + case "Sell": return Cursor.Sell; default: return null; } diff --git a/OpenRa.Game/Cursor.cs b/OpenRa.Game/Cursor.cs index b59bbf6d3d..7c9dd60770 100644 --- a/OpenRa.Game/Cursor.cs +++ b/OpenRa.Game/Cursor.cs @@ -26,5 +26,6 @@ namespace OpenRa.Game public static Cursor C4 { get { return new Cursor("c4"); } } 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"); } } } } diff --git a/OpenRa.Game/Traits/Building.cs b/OpenRa.Game/Traits/Building.cs index 63a1eda894..d102eb3c25 100644 --- a/OpenRa.Game/Traits/Building.cs +++ b/OpenRa.Game/Traits/Building.cs @@ -1,8 +1,9 @@ using OpenRa.Game.GameRules; +using OpenRa.Game.Traits.Activities; namespace OpenRa.Game.Traits { - class Building : INotifyDamage + class Building : INotifyDamage, IOrder { public readonly BuildingInfo unitInfo; @@ -18,5 +19,19 @@ namespace OpenRa.Game.Traits if (e.DamageState == DamageState.Dead) Sound.Play("kaboom22.aud"); } + + public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor) + { + return null; // sell/repair orders are issued through Chrome, not here. + } + + public void ResolveOrder(Actor self, Order order) + { + if (order.OrderString == "Sell") + { + self.CancelActivity(); + self.QueueActivity(new Sell()); + } + } } }