diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index 3d99808bbc..b445f68937 100755 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -101,7 +101,7 @@ namespace OpenRa.Game if (underCursor != null && !underCursor.Info.Selectable) underCursor = null; - return traits.WithInterface() + return traits.WithInterface() .Select( x => x.IssueOrder( this, xy, mi, underCursor ) ) .FirstOrDefault( x => x != null ); } diff --git a/OpenRa.Game/Orders/UnitOrders.cs b/OpenRa.Game/Orders/UnitOrders.cs index 4a03e43ea0..6e11cfad3a 100644 --- a/OpenRa.Game/Orders/UnitOrders.cs +++ b/OpenRa.Game/Orders/UnitOrders.cs @@ -97,7 +97,7 @@ namespace OpenRa.Game.Orders default: { - foreach (var t in order.Subject.traits.WithInterface()) + foreach (var t in order.Subject.traits.WithInterface()) t.ResolveOrder(order.Subject, order); break; } diff --git a/OpenRa.Game/Traits/AttackBase.cs b/OpenRa.Game/Traits/AttackBase.cs index 411770437b..9cc97b871f 100644 --- a/OpenRa.Game/Traits/AttackBase.cs +++ b/OpenRa.Game/Traits/AttackBase.cs @@ -6,7 +6,7 @@ using OpenRa.Game.Effects; namespace OpenRa.Game.Traits { - class AttackBase : IOrder, ITick + class AttackBase : IIssueOrder, IResolveOrder, ITick { public Actor target; diff --git a/OpenRa.Game/Traits/Building.cs b/OpenRa.Game/Traits/Building.cs index bd48fc1c0d..927fc58eee 100644 --- a/OpenRa.Game/Traits/Building.cs +++ b/OpenRa.Game/Traits/Building.cs @@ -9,7 +9,7 @@ using OpenRa.Game.Graphics; namespace OpenRa.Game.Traits { - class Building : INotifyDamage, IOrder, ITick + class Building : INotifyDamage, IResolveOrder, ITick { readonly Actor self; public readonly BuildingInfo unitInfo; @@ -44,11 +44,6 @@ namespace OpenRa.Game.Traits 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") diff --git a/OpenRa.Game/Traits/C4Demolition.cs b/OpenRa.Game/Traits/C4Demolition.cs index b2a1db306b..e6b75178b2 100644 --- a/OpenRa.Game/Traits/C4Demolition.cs +++ b/OpenRa.Game/Traits/C4Demolition.cs @@ -2,7 +2,7 @@ namespace OpenRa.Game.Traits { - class C4Demolition : IOrder + class C4Demolition : IIssueOrder, IResolveOrder { public C4Demolition(Actor self) { } diff --git a/OpenRa.Game/Traits/Cargo.cs b/OpenRa.Game/Traits/Cargo.cs index 3d1f27cea0..088cde0640 100644 --- a/OpenRa.Game/Traits/Cargo.cs +++ b/OpenRa.Game/Traits/Cargo.cs @@ -7,7 +7,7 @@ using OpenRa.Game.Traits.Activities; namespace OpenRa.Game.Traits { - class Cargo : IPips, IOrder + class Cargo : IPips, IIssueOrder, IResolveOrder { List cargo = new List(); diff --git a/OpenRa.Game/Traits/ChronoshiftDeploy.cs b/OpenRa.Game/Traits/ChronoshiftDeploy.cs index 6e14c5faf4..16aeb0d9fe 100644 --- a/OpenRa.Game/Traits/ChronoshiftDeploy.cs +++ b/OpenRa.Game/Traits/ChronoshiftDeploy.cs @@ -4,7 +4,7 @@ using OpenRa.Game.Orders; namespace OpenRa.Game.Traits { - class ChronoshiftDeploy : IOrder, ISpeedModifier, ITick, IPips + class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ISpeedModifier, ITick, IPips { // Recharge logic int chargeTick = 0; // How long until we can chronoshift again? diff --git a/OpenRa.Game/Traits/Chronoshiftable.cs b/OpenRa.Game/Traits/Chronoshiftable.cs index e5261e5361..82792b2bcf 100644 --- a/OpenRa.Game/Traits/Chronoshiftable.cs +++ b/OpenRa.Game/Traits/Chronoshiftable.cs @@ -5,7 +5,7 @@ using System.Linq; namespace OpenRa.Game.Traits { - class Chronoshiftable : IOrder, ISpeedModifier, ITick + class Chronoshiftable : IResolveOrder, ISpeedModifier, ITick { // Return-to-sender logic int2 chronoshiftOrigin; @@ -30,11 +30,6 @@ namespace OpenRa.Game.Traits } } - public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor) - { - return null; // Chronoshift order is issued through Chrome. - } - public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "ChronosphereSelect") diff --git a/OpenRa.Game/Traits/ConstructionYard.cs b/OpenRa.Game/Traits/ConstructionYard.cs index a7bec51066..0dbcc76277 100644 --- a/OpenRa.Game/Traits/ConstructionYard.cs +++ b/OpenRa.Game/Traits/ConstructionYard.cs @@ -3,7 +3,7 @@ using OpenRa.Game.Traits.Activities; namespace OpenRa.Game.Traits { - class ConstructionYard : IOrder, IMovement + class ConstructionYard : IIssueOrder, IResolveOrder, IMovement { readonly Actor self; diff --git a/OpenRa.Game/Traits/DemoTruck.cs b/OpenRa.Game/Traits/DemoTruck.cs index b84bcdec27..53a3d86a1e 100644 --- a/OpenRa.Game/Traits/DemoTruck.cs +++ b/OpenRa.Game/Traits/DemoTruck.cs @@ -6,7 +6,7 @@ using OpenRa.Game.Orders; namespace OpenRa.Game.Traits { - class DemoTruck : Chronoshiftable, IOrder, INotifyDamage + class DemoTruck : Chronoshiftable, IResolveOrder, INotifyDamage { readonly Actor self; public DemoTruck(Actor self) diff --git a/OpenRa.Game/Traits/EngineerCapture.cs b/OpenRa.Game/Traits/EngineerCapture.cs index 5a31ff027d..771e2a015a 100644 --- a/OpenRa.Game/Traits/EngineerCapture.cs +++ b/OpenRa.Game/Traits/EngineerCapture.cs @@ -2,7 +2,7 @@ namespace OpenRa.Game.Traits { - class EngineerCapture : IOrder + class EngineerCapture : IIssueOrder, IResolveOrder { public const int EngineerDamage = 300; // todo: push into rules, as a weapon diff --git a/OpenRa.Game/Traits/Harvester.cs b/OpenRa.Game/Traits/Harvester.cs index f68f52f008..a7607e43aa 100644 --- a/OpenRa.Game/Traits/Harvester.cs +++ b/OpenRa.Game/Traits/Harvester.cs @@ -3,7 +3,7 @@ using OpenRa.Game.Traits.Activities; namespace OpenRa.Game.Traits { - class Harvester : IOrder, IPips + class Harvester : IIssueOrder, IResolveOrder, IPips { public int oreCarried = 0; /* sum of these must not exceed capacity */ public int gemsCarried = 0; diff --git a/OpenRa.Game/Traits/Helicopter.cs b/OpenRa.Game/Traits/Helicopter.cs index 2568ed968d..27d6143c8b 100644 --- a/OpenRa.Game/Traits/Helicopter.cs +++ b/OpenRa.Game/Traits/Helicopter.cs @@ -4,7 +4,7 @@ using OpenRa.Game.GameRules; namespace OpenRa.Game.Traits { - class Helicopter : IOrder, IMovement + class Helicopter : IIssueOrder, IResolveOrder, IMovement { public IDisposable reservation; public Helicopter(Actor self) {} diff --git a/OpenRa.Game/Traits/IronCurtainable.cs b/OpenRa.Game/Traits/IronCurtainable.cs index bfb691de44..1783136810 100644 --- a/OpenRa.Game/Traits/IronCurtainable.cs +++ b/OpenRa.Game/Traits/IronCurtainable.cs @@ -3,7 +3,7 @@ using OpenRa.Game.Effects; namespace OpenRa.Game.Traits { - class IronCurtainable : IOrder, IDamageModifier, ITick + class IronCurtainable : IResolveOrder, IDamageModifier, ITick { int RemainingTicks = 0; @@ -19,11 +19,6 @@ namespace OpenRa.Game.Traits return (RemainingTicks > 0) ? 0.0f : 1.0f; } - public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor) - { - return null; // IronCurtain order is issued through Chrome. - } - public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "IronCurtain") diff --git a/OpenRa.Game/Traits/McvDeploy.cs b/OpenRa.Game/Traits/McvDeploy.cs index 1534d64253..4848378acb 100644 --- a/OpenRa.Game/Traits/McvDeploy.cs +++ b/OpenRa.Game/Traits/McvDeploy.cs @@ -3,7 +3,7 @@ using OpenRa.Game.Traits.Activities; namespace OpenRa.Game.Traits { - class McvDeploy : IOrder + class McvDeploy : IIssueOrder, IResolveOrder { public McvDeploy(Actor self) { } diff --git a/OpenRa.Game/Traits/Minelayer.cs b/OpenRa.Game/Traits/Minelayer.cs index 053c7d0d8c..871029b159 100644 --- a/OpenRa.Game/Traits/Minelayer.cs +++ b/OpenRa.Game/Traits/Minelayer.cs @@ -5,7 +5,7 @@ using System.Text; namespace OpenRa.Game.Traits { - class Minelayer : IOrder + class Minelayer : IIssueOrder, IResolveOrder { public Minelayer(Actor self) { } diff --git a/OpenRa.Game/Traits/Mobile.cs b/OpenRa.Game/Traits/Mobile.cs index e917df2610..4e53190603 100644 --- a/OpenRa.Game/Traits/Mobile.cs +++ b/OpenRa.Game/Traits/Mobile.cs @@ -5,7 +5,7 @@ using OpenRa.Game.GameRules; namespace OpenRa.Game.Traits { - class Mobile : IOrder, IOccupySpace, IMovement + class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMovement { readonly Actor self; diff --git a/OpenRa.Game/Traits/Passenger.cs b/OpenRa.Game/Traits/Passenger.cs index 29521ecb09..20ee863d2d 100644 --- a/OpenRa.Game/Traits/Passenger.cs +++ b/OpenRa.Game/Traits/Passenger.cs @@ -6,7 +6,7 @@ using OpenRa.Game.Traits.Activities; namespace OpenRa.Game.Traits { - class Passenger : IOrder + class Passenger : IIssueOrder, IResolveOrder { public Passenger(Actor self) { } diff --git a/OpenRa.Game/Traits/Plane.cs b/OpenRa.Game/Traits/Plane.cs index f01c38e76b..6b5c9827a3 100644 --- a/OpenRa.Game/Traits/Plane.cs +++ b/OpenRa.Game/Traits/Plane.cs @@ -6,7 +6,7 @@ using OpenRa.Game.Traits.Activities; namespace OpenRa.Game.Traits { - class Plane : IOrder, IMovement + class Plane : IIssueOrder, IResolveOrder, IMovement { public IDisposable reservation; diff --git a/OpenRa.Game/Traits/Production.cs b/OpenRa.Game/Traits/Production.cs index e24eec3a68..fb83d73a85 100755 --- a/OpenRa.Game/Traits/Production.cs +++ b/OpenRa.Game/Traits/Production.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace OpenRa.Game.Traits { - class Production : IOrder, IProducer, ITags + class Production : IIssueOrder, IResolveOrder, IProducer, ITags { bool isPrimary = false; public bool IsPrimary { get { return isPrimary; } } @@ -66,9 +66,7 @@ namespace OpenRa.Game.Traits public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "Deploy") - { SetPrimaryProducer(self, !isPrimary); - } } public void SetPrimaryProducer(Actor self, bool state) diff --git a/OpenRa.Game/Traits/ProductionQueue.cs b/OpenRa.Game/Traits/ProductionQueue.cs index 824229b64d..e42bd59a3f 100755 --- a/OpenRa.Game/Traits/ProductionQueue.cs +++ b/OpenRa.Game/Traits/ProductionQueue.cs @@ -6,7 +6,7 @@ using IjwFramework.Collections; namespace OpenRa.Game.Traits { - class ProductionQueue : IOrder, ITick + class ProductionQueue : IResolveOrder, ITick { Actor self; @@ -22,12 +22,6 @@ namespace OpenRa.Game.Traits (p.Value)[0].Tick( self.Owner ); } - public Order IssueOrder( Actor self, int2 xy, MouseInput mi, Actor underCursor ) - { - // production isn't done by clicks in the world; the chrome handles it. - return null; - } - public void ResolveOrder( Actor self, Order order ) { switch( order.OrderString ) diff --git a/OpenRa.Game/Traits/RallyPoint.cs b/OpenRa.Game/Traits/RallyPoint.cs index 21edb5e0f1..eebcef0b7e 100644 --- a/OpenRa.Game/Traits/RallyPoint.cs +++ b/OpenRa.Game/Traits/RallyPoint.cs @@ -4,7 +4,7 @@ using OpenRa.Game.Orders; namespace OpenRa.Game.Traits { - class RallyPoint : IRender, IOrder, ITick + class RallyPoint : IRender, IIssueOrder, IResolveOrder, ITick { public int2 rallyPoint; public Animation anim; diff --git a/OpenRa.Game/Traits/Repairable.cs b/OpenRa.Game/Traits/Repairable.cs index b5cafac857..c5c38caf84 100644 --- a/OpenRa.Game/Traits/Repairable.cs +++ b/OpenRa.Game/Traits/Repairable.cs @@ -6,7 +6,7 @@ using OpenRa.Game.Traits.Activities; namespace OpenRa.Game.Traits { - class Repairable : IOrder + class Repairable : IIssueOrder, IResolveOrder { IDisposable reservation; public Repairable(Actor self) { } diff --git a/OpenRa.Game/Traits/Thief.cs b/OpenRa.Game/Traits/Thief.cs index 362436fae0..54b34b5d5c 100644 --- a/OpenRa.Game/Traits/Thief.cs +++ b/OpenRa.Game/Traits/Thief.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; namespace OpenRa.Game.Traits { - class Thief : IOrder + class Thief : IIssueOrder, IResolveOrder { public Thief(Actor self) { } diff --git a/OpenRa.Game/Traits/TraitsInterfaces.cs b/OpenRa.Game/Traits/TraitsInterfaces.cs index 11dc8713ad..8ac3f3258b 100644 --- a/OpenRa.Game/Traits/TraitsInterfaces.cs +++ b/OpenRa.Game/Traits/TraitsInterfaces.cs @@ -18,11 +18,10 @@ namespace OpenRa.Game.Traits interface INotifyBuildComplete { void BuildingComplete (Actor self); } interface INotifyProduction { void UnitProduced(Actor self, Actor other); } interface IAcceptThief { void OnSteal(Actor self, Actor thief); } - interface IOrder - { - Order IssueOrder( Actor self, int2 xy, MouseInput mi, Actor underCursor ); - void ResolveOrder( Actor self, Order order ); - } + + interface IIssueOrder { Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor); } + interface IResolveOrder { void ResolveOrder(Actor self, Order order); } + interface IProducer { bool Produce( Actor self, UnitInfo producee );