diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 69909348a5..12844e1aed 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -246,12 +246,12 @@ namespace OpenRa.Game void DrawButtons() { // Repair - Rectangle repairRect = new Rectangle(Game.viewport.Width - 100, 5,repairButton.Image.bounds.Width, repairButton.Image.bounds.Height); + Rectangle repairRect = new Rectangle(Game.viewport.Width - 100, 5, repairButton.Image.bounds.Width, repairButton.Image.bounds.Height); var repairDrawPos = Game.viewport.Location + new float2(repairRect.Location); var hasFact = Game.world.Actors.Any(a => a.Owner == Game.LocalPlayer && a.traits.Contains()); - if (!hasFact) + if (Game.Settings.RepairRequiresConyard && !hasFact) repairButton.ReplaceAnim("disabled"); else { @@ -260,13 +260,13 @@ namespace OpenRa.Game } buildPaletteRenderer.DrawSprite(repairButton.Image, repairDrawPos, PaletteType.Chrome); - + // Sell Rectangle sellRect = new Rectangle(Game.viewport.Width - 60, 5, sellButton.Image.bounds.Width, sellButton.Image.bounds.Height); var sellDrawPos = Game.viewport.Location + new float2(sellRect.Location); - repairButton.ReplaceAnim(Game.controller.orderGenerator is SellOrderGenerator ? "pressed" : "normal"); + sellButton.ReplaceAnim(Game.controller.orderGenerator is SellOrderGenerator ? "pressed" : "normal"); AddButton(sellRect, isLmb => Game.controller.ToggleInputMode()); buildPaletteRenderer.DrawSprite(sellButton.Image, sellDrawPos, PaletteType.Chrome); diff --git a/OpenRa.Game/GameRules/UserSettings.cs b/OpenRa.Game/GameRules/UserSettings.cs index 2622ce9641..bc502d4c36 100644 --- a/OpenRa.Game/GameRules/UserSettings.cs +++ b/OpenRa.Game/GameRules/UserSettings.cs @@ -3,19 +3,30 @@ namespace OpenRa.Game.GameRules { class UserSettings { + // Debug settings public readonly bool UnitDebug = false; public readonly bool BuildingDebug = false; public readonly bool PathDebug = false; + + // Window settings + public readonly int Width = 0; + public readonly int Height = 0; + public readonly bool Fullscreen = false; + + // Internal game settings public readonly int Timestep = 40; - public readonly string Replay = ""; + public readonly int SheetSize = 512; + + // External game settings public readonly bool UseAftermath = false; public readonly string NetworkHost = ""; public readonly int NetworkPort = 0; - public readonly int SheetSize = 512; - public readonly bool Fullscreen = false; public readonly string Map = "scm12ea.ini"; public readonly int Player = 1; - public readonly int Width = 0; - public readonly int Height = 0; + public readonly string Replay = ""; + + // Gameplay options + public readonly bool RepairRequiresConyard = false; + } } diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index 750d964d71..d3f8017fa1 100755 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -45,28 +45,31 @@ namespace OpenRa.Game // Load user settings Game.Settings = new UserSettings(); - try - { - FileSystem.MountTemporary(new Folder("./")); - IniFile SettingsRules = new IniFile(FileSystem.Open("settings.ini")); - FieldLoader.Load(Game.Settings, SettingsRules.GetSection("Settings")); - FileSystem.UnmountTemporaryPackages(); - } - catch (FileNotFoundException) {} - UiOverlay.ShowUnitDebug = Game.Settings.UnitDebug; - UiOverlay.ShowBuildDebug = Game.Settings.BuildingDebug; - WorldRenderer.ShowUnitPaths = Game.Settings.PathDebug; - Renderer.SheetSize = Game.Settings.SheetSize; - while (!File.Exists("redalert.mix")) { var current = Directory.GetCurrentDirectory(); if (Directory.GetDirectoryRoot(current) == current) throw new InvalidOperationException("Unable to load MIX files."); Directory.SetCurrentDirectory(".."); + + try + { + // settings.ini should be located with the mix files + FileSystem.MountTemporary(new Folder("./")); + IniFile SettingsRules = new IniFile(FileSystem.Open("settings.ini")); + FieldLoader.Load(Game.Settings, SettingsRules.GetSection("Settings")); + FileSystem.UnmountTemporaryPackages(); + } + catch (FileNotFoundException) { } } + UiOverlay.ShowUnitDebug = Game.Settings.UnitDebug; + UiOverlay.ShowBuildDebug = Game.Settings.BuildingDebug; + WorldRenderer.ShowUnitPaths = Game.Settings.PathDebug; + Renderer.SheetSize = Game.Settings.SheetSize; + + FileSystem.MountDefaultPackages(); if (Game.Settings.UseAftermath) diff --git a/OpenRa.Game/Orders/RepairOrderGenerator.cs b/OpenRa.Game/Orders/RepairOrderGenerator.cs index 6a71252614..299c2e65a5 100644 --- a/OpenRa.Game/Orders/RepairOrderGenerator.cs +++ b/OpenRa.Game/Orders/RepairOrderGenerator.cs @@ -36,11 +36,14 @@ namespace OpenRa.Game.Orders public void Tick() { - var hasFact = Game.world.Actors - .Any(a => a.Owner == Game.LocalPlayer && a.traits.Contains()); - - if (!hasFact) - Game.controller.CancelInputMode(); + if (Game.Settings.RepairRequiresConyard) + { + var hasFact = Game.world.Actors + .Any(a => a.Owner == Game.LocalPlayer && a.traits.Contains()); + + if (!hasFact) + Game.controller.CancelInputMode(); + } }