summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-12-30 19:38:48 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-12-30 19:38:48 -0500
commitf95292953f95ec71071fce7a6438a5403dc85816 (patch)
treef0f1924cea947761e84a6265619e7e6b4374df3a
parentfd37253dc3aa12be5b11b8d377eae3ced88bc30c (diff)
downloadSMAPI-f95292953f95ec71071fce7a6438a5403dc85816.tar.gz
SMAPI-f95292953f95ec71071fce7a6438a5403dc85816.tar.bz2
SMAPI-f95292953f95ec71071fce7a6438a5403dc85816.zip
fix repeated mods in 'skipped mods' section of console
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Framework/Logging/LogManager.cs18
2 files changed, 15 insertions, 4 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index c68b3d62..dbc8e905 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -10,6 +10,7 @@
## Upcoming release
* For players:
* Updated compatibility list.
+ * Fixed 'skipped mods' section repeating mods in some cases.
* For modders:
* When a mod is blocked by SMAPI's internal compatibility list, the `TRACE` messages while loading it now indicates that and specifies the reason.
diff --git a/src/SMAPI/Framework/Logging/LogManager.cs b/src/SMAPI/Framework/Logging/LogManager.cs
index ee013a85..4a8019af 100644
--- a/src/SMAPI/Framework/Logging/LogManager.cs
+++ b/src/SMAPI/Framework/Logging/LogManager.cs
@@ -425,9 +425,11 @@ namespace StardewModdingAPI.Framework.Logging
this.Monitor.Log($" ({mod.ErrorDetails})");
}
- // find skipped dependencies
- IModMetadata[] skippedDependencies;
+ // group mods
+ List<IModMetadata> skippedDependencies = new List<IModMetadata>();
+ List<IModMetadata> otherSkippedMods = new List<IModMetadata>();
{
+ // track broken dependencies
HashSet<string> skippedDependencyIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
HashSet<string> skippedModIds = new HashSet<string>(from mod in skippedMods where mod.HasID() select mod.Manifest.UniqueID, StringComparer.OrdinalIgnoreCase);
foreach (IModMetadata mod in skippedMods)
@@ -435,7 +437,15 @@ namespace StardewModdingAPI.Framework.Logging
foreach (string requiredId in skippedModIds.Intersect(mod.GetRequiredModIds()))
skippedDependencyIds.Add(requiredId);
}
- skippedDependencies = skippedMods.Where(p => p.HasID() && skippedDependencyIds.Contains(p.Manifest.UniqueID)).ToArray();
+
+ // collect mod groups
+ foreach (IModMetadata mod in skippedMods)
+ {
+ if (mod.HasID() && skippedDependencyIds.Contains(mod.Manifest.UniqueID))
+ skippedDependencies.Add(mod);
+ else
+ otherSkippedMods.Add(mod);
+ }
}
// log skipped mods
@@ -451,7 +461,7 @@ namespace StardewModdingAPI.Framework.Logging
this.Monitor.Newline();
}
- foreach (IModMetadata mod in skippedMods.OrderBy(p => p.DisplayName))
+ foreach (IModMetadata mod in otherSkippedMods.OrderBy(p => p.DisplayName))
LogSkippedMod(mod);
this.Monitor.Newline();
}