From 34f382ec5727bc628e3ab478d33a89f1666186e4 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Wed, 4 Mar 2015 18:52:38 +0100 Subject: [PATCH] Prevent unnecessary blinking of the options button in non-mission type games The options button starts blinking when a new objective is added, which happens in all game modes, even skirmish and koth. This change prevents the button from blinking in the latter two cases. This prevents 1) confusion on part of the players, and 2) an unnecessary announcement of the objective since in skirmish and koth it is always the same. --- .../Traits/Player/ConquestVictoryConditions.cs | 2 +- OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs | 6 +++--- .../Traits/Player/StrategicVictoryConditions.cs | 2 +- .../Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs | 2 +- .../Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs index 7137e6de78..1becb442c3 100644 --- a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits if (self.Owner.WinState != WinState.Undefined || self.Owner.NonCombatant) return; if (objectiveID < 0) - objectiveID = mo.Add(self.Owner, "Destroy all opposition!"); + objectiveID = mo.Add(self.Owner, "Destroy all opposition!", ObjectiveType.Primary, true); if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits()) mo.MarkFailed(self.Owner, objectiveID); diff --git a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs index ff86f180d0..6d7aa0a1d7 100644 --- a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs +++ b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs @@ -72,13 +72,13 @@ namespace OpenRA.Mods.Common.Traits world.ObserveAfterWinOrLose = !info.EarlyGameOver; } - public int Add(Player player, string description, ObjectiveType type = ObjectiveType.Primary) + public int Add(Player player, string description, ObjectiveType type = ObjectiveType.Primary, bool inhibitAnnouncement = false) { var newID = objectives.Count; objectives.Insert(newID, new MissionObjective(type, description)); - ObjectiveAdded(player); + ObjectiveAdded(player, inhibitAnnouncement); foreach (var inou in player.PlayerActor.TraitsImplementing()) inou.OnObjectiveAdded(player, newID); @@ -231,7 +231,7 @@ namespace OpenRA.Mods.Common.Traits MarkFailed(player, id); } - public event Action ObjectiveAdded = player => { player.HasObjectives = true; }; + public event Action ObjectiveAdded = (player, inhibitAnnouncement) => { player.HasObjectives = true; }; public void OnObjectiveAdded(Player player, int id) { } public void OnObjectiveCompleted(Player player, int id) { } diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index e58e41e443..f1e29c0837 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits if (player.WinState != WinState.Undefined || player.NonCombatant) return; if (objectiveID < 0) - objectiveID = mo.Add(player, "Hold all the strategic positions for a specified time!"); + objectiveID = mo.Add(player, "Hold all the strategic positions for a specified time!", ObjectiveType.Primary, true); if (!self.Owner.NonCombatant && self.Owner.HasNoRequiredUnits()) mo.MarkFailed(self.Owner, objectiveID); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs index f10276ab7d..3f68270eb4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic PopulateObjectivesList(mo, objectivesPanel, template); - Action redrawObjectives = player => + Action redrawObjectives = (player, _) => { if (player == lp) PopulateObjectivesList(mo, objectivesPanel, template); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs index f6972aceae..0e4c082a11 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs @@ -55,9 +55,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (lp != null) { - Action startBlinking = player => + Action startBlinking = (player, inhibitAnnouncement) => { - if (player == world.LocalPlayer) + if (!inhibitAnnouncement && player == world.LocalPlayer) blinking = true; };