summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading/ModMetadata.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-02-28 12:39:37 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-02-28 12:39:37 -0500
commit403616b07c6da6479ce77fd45b41f622e9972915 (patch)
treeaa4cd1eb1f5ffba5f15b7f70226259ae1bb09a21 /src/SMAPI/Framework/ModLoading/ModMetadata.cs
parent944c03737e7f7d7788f4321224a4e59a4f04717d (diff)
downloadSMAPI-403616b07c6da6479ce77fd45b41f622e9972915.tar.gz
SMAPI-403616b07c6da6479ce77fd45b41f622e9972915.tar.bz2
SMAPI-403616b07c6da6479ce77fd45b41f622e9972915.zip
fix mods with suppressed warnings counted for showing the log section
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/ModMetadata.cs')
-rw-r--r--src/SMAPI/Framework/ModLoading/ModMetadata.cs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
index 18d2b112..b4de3d6c 100644
--- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs
+++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
@@ -14,6 +14,13 @@ namespace StardewModdingAPI.Framework.ModLoading
internal class ModMetadata : IModMetadata
{
/*********
+ ** Fields
+ *********/
+ /// <summary>The non-error issues with the mod, including warnings suppressed by the data record.</summary>
+ private ModWarning ActualWarnings = ModWarning.None;
+
+
+ /*********
** Accessors
*********/
/// <inheritdoc />
@@ -41,7 +48,7 @@ namespace StardewModdingAPI.Framework.ModLoading
public ModFailReason? FailReason { get; private set; }
/// <inheritdoc />
- public ModWarning Warnings { get; private set; }
+ public ModWarning Warnings => this.ActualWarnings & ~(this.DataRecord?.DataRecord.SuppressWarnings ?? ModWarning.None);
/// <inheritdoc />
public string Error { get; private set; }
@@ -116,7 +123,7 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <inheritdoc />
public IModMetadata SetWarning(ModWarning warning)
{
- this.Warnings |= warning;
+ this.ActualWarnings |= warning;
return this;
}
@@ -218,12 +225,10 @@ namespace StardewModdingAPI.Framework.ModLoading
}
/// <inheritdoc />
- public bool HasUnsuppressedWarnings(params ModWarning[] warnings)
+ public bool HasWarnings(params ModWarning[] warnings)
{
- return warnings.Any(warning =>
- this.Warnings.HasFlag(warning)
- && (this.DataRecord?.DataRecord == null || !this.DataRecord.DataRecord.SuppressWarnings.HasFlag(warning))
- );
+ ModWarning curWarnings = this.Warnings;
+ return warnings.Any(warning => curWarnings.HasFlag(warning));
}
/// <inheritdoc />