From 74c63812ebccc9105a69445f0b01aacf798c5770 Mon Sep 17 00:00:00 2001 From: atlimit8 Date: Sun, 1 Nov 2015 17:14:46 -0600 Subject: [PATCH] Show only missing required "mod (version)"s --- OpenRA.Game/Game.cs | 10 ++++++++-- .../Widgets/Logic/Installation/InstallModLogic.cs | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 07b6522dd1..beb9699510 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -9,6 +9,7 @@ #endregion using System; +using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; @@ -255,9 +256,14 @@ namespace OpenRA public static bool IsModInstalled(string modId) { - return Manifest.AllMods[modId].RequiresMods.All(mod => ModMetadata.AllMods.ContainsKey(mod.Key) + return Manifest.AllMods[modId].RequiresMods.All(IsModInstalled); + } + + public static bool IsModInstalled(KeyValuePair mod) + { + return ModMetadata.AllMods.ContainsKey(mod.Key) && ModMetadata.AllMods[mod.Key].Version == mod.Value - && IsModInstalled(mod.Key)); + && IsModInstalled(mod.Key); } public static void InitializeMod(string mod, Arguments args) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallModLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallModLogic.cs index e89ee00cad..b918827bdb 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallModLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallModLogic.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var panel = widget.Get("INSTALL_MOD_PANEL"); - var mods = Manifest.AllMods[modId].RequiresMods.Select(x => "{0} ({1})".F(x.Key, x.Value)); + var mods = Manifest.AllMods[modId].RequiresMods.Where(m => !Game.IsModInstalled(m)).Select(m => "{0} ({1})".F(m.Key, m.Value)); var text = string.Join(", ", mods); panel.Get("MOD_LIST").Text = text;