diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 68db9e5126..ba8c5b6dc6 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -151,14 +151,9 @@ namespace OpenRA ChangeMap(mapName); if( Settings.Replay != "" ) - { - var connection = new ReplayConnection( Settings.Replay ); - orderManager = new OrderManager( connection ); - } + orderManager = new OrderManager( new ReplayConnection( Settings.Replay ) ); else - { JoinLocal(); - } } internal static void JoinServer(string host, int port) @@ -421,7 +416,7 @@ namespace OpenRA renderer = new Renderer(resolution, windowed); resolution = renderer.Resolution; - var controller = new Controller(); /* a bit of insane input routing */ + var controller = new Controller(); Game.Initialize(Game.Settings.Map, renderer, new int2(resolution), Game.Settings.Player, controller); diff --git a/OpenRA.Game/GameRules/UserSettings.cs b/OpenRA.Game/GameRules/UserSettings.cs index b653d5eb0d..007917d68e 100644 --- a/OpenRA.Game/GameRules/UserSettings.cs +++ b/OpenRA.Game/GameRules/UserSettings.cs @@ -50,10 +50,5 @@ namespace OpenRA.GameRules public readonly int ExternalPort = 1234; public readonly bool InternetServer = true; public readonly string MasterServer = "http://open-ra.org/master/"; - - // Gameplay options - // TODO: These need to die - public readonly bool RepairRequiresConyard = true; - public readonly bool PowerDownBuildings = true; } } diff --git a/OpenRA.Game/Orders/RepairOrderGenerator.cs b/OpenRA.Game/Orders/RepairOrderGenerator.cs index 31a8d0b561..ffd5296917 100644 --- a/OpenRA.Game/Orders/RepairOrderGenerator.cs +++ b/OpenRA.Game/Orders/RepairOrderGenerator.cs @@ -52,9 +52,6 @@ namespace OpenRA.Orders public void Tick( World world ) { - if (!Game.Settings.RepairRequiresConyard) - return; - var hasFact = world.Queries.OwnedBy[world.LocalPlayer] .WithTrait() .Any(); diff --git a/OpenRA.Game/Traits/Chrome/PowerDownButton.cs b/OpenRA.Game/Traits/Chrome/PowerDownButton.cs index 09aa6d94fd..3570978610 100644 --- a/OpenRA.Game/Traits/Chrome/PowerDownButton.cs +++ b/OpenRA.Game/Traits/Chrome/PowerDownButton.cs @@ -24,20 +24,25 @@ namespace OpenRA.Traits public void OnClick() { Game.controller.ToggleInputMode(); } } - class RepairButtonInfo : StatelessTraitInfo { } + class RepairButtonInfo : ITraitInfo + { + public readonly bool RequiresConstructionYard = true; + public object Create(Actor self) { return new RepairButton(this); } + } class RepairButton : IChromeButton { - public string Image { get { return "repair"; } } // todo: art + RepairButtonInfo info; + public RepairButton( RepairButtonInfo info ) { this.info = info; } + + public string Image { get { return "repair"; } } public bool Enabled { get { - if (!Game.Settings.RepairRequiresConyard) - return true; - - return Game.world.Queries.OwnedBy[Game.world.LocalPlayer] - .WithTrait().Any(); + return !info.RequiresConstructionYard || + Game.world.Queries.OwnedBy[Game.world.LocalPlayer] + .WithTrait().Any(); } }