diff --git a/OpenRA.Mods.RA/ConquestVictoryConditions.cs b/OpenRA.Mods.RA/ConquestVictoryConditions.cs index f4e277d44c..8e37a578ea 100644 --- a/OpenRA.Mods.RA/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.RA/ConquestVictoryConditions.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA public object Create(ActorInitializer init) { return new ConquestVictoryConditions(init.self, this); } } - public class ConquestVictoryConditions : ITick, IResolveOrder, INotifyObjectivesUpdated + public class ConquestVictoryConditions : ITick, INotifyObjectivesUpdated { readonly ConquestVictoryConditionsInfo info; readonly MissionObjectives mo; diff --git a/OpenRA.Mods.RA/Player/MissionObjectives.cs b/OpenRA.Mods.RA/Player/MissionObjectives.cs index fc0b5632d5..8c907495eb 100644 --- a/OpenRA.Mods.RA/Player/MissionObjectives.cs +++ b/OpenRA.Mods.RA/Player/MissionObjectives.cs @@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA public object Create(ActorInitializer init) { return new MissionObjectives(init.world, this); } } - public class MissionObjectives : INotifyObjectivesUpdated, ISync + public class MissionObjectives : INotifyObjectivesUpdated, ISync, IResolveOrder { readonly MissionObjectivesInfo info; readonly List objectives = new List(); @@ -202,6 +202,13 @@ namespace OpenRA.Mods.RA public void OnObjectiveAdded(Player player, int id) {} public void OnObjectiveCompleted(Player player, int id) {} public void OnObjectiveFailed(Player player, int id) {} + + public void ResolveOrder(Actor self, Order order) + { + if (order.OrderString == "Surrender") + for (var id = 0; id < objectives.Count; id++) + MarkFailed(self.Owner, id); + } } [Desc("Provides game mode progress information for players.", diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameMenuLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameMenuLogic.cs index 50fabfb33f..eff7114022 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameMenuLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameMenuLogic.cs @@ -85,7 +85,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic hideMenu = true; ConfirmationDialogs.PromptConfirmAction("Surrender", "Are you sure you want to surrender?", onSurrender, showMenu); }; - widget.Get("SURRENDER").IsVisible = () => world.LocalPlayer != null && world.LocalPlayer.WinState == WinState.Undefined; + surrenderButton.IsDisabled = () => world.LocalPlayer == null || world.LocalPlayer.WinState != WinState.Undefined; menu.Get("MUSIC").OnClick = () => { @@ -97,7 +97,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic }); }; - menu.Get("SETTINGS").OnClick = () => + var settingsButton = widget.Get("SETTINGS"); + settingsButton.OnClick = () => { hideMenu = true; Ui.OpenWindow("SETTINGS_PANEL", new WidgetArgs()