summaryrefslogtreecommitdiff
path: root/src/SMAPI/Context.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-15 01:54:01 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-15 01:54:01 -0400
commit048f41244f6b2c7f95ac5bf75be2b16f42b99169 (patch)
tree59f6937d63653a7cb3ec04fde9f76539429a7854 /src/SMAPI/Context.cs
parent3a4758dfa63f0f8e03166bffa15e16f7995499d7 (diff)
downloadSMAPI-048f41244f6b2c7f95ac5bf75be2b16f42b99169.tar.gz
SMAPI-048f41244f6b2c7f95ac5bf75be2b16f42b99169.tar.bz2
SMAPI-048f41244f6b2c7f95ac5bf75be2b16f42b99169.zip
reduce performance impact of deprecation warnings
Creating a stack is *very* slow, so it should be avoided if possible until after the duplicate-warning check.
Diffstat (limited to 'src/SMAPI/Context.cs')
-rw-r--r--src/SMAPI/Context.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/SMAPI/Context.cs b/src/SMAPI/Context.cs
index aa4ecf35..c822908e 100644
--- a/src/SMAPI/Context.cs
+++ b/src/SMAPI/Context.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using StardewModdingAPI.Enums;
using StardewModdingAPI.Events;
+using StardewModdingAPI.Framework;
using StardewModdingAPI.Utilities;
using StardewValley;
using StardewValley.Menus;
@@ -41,6 +42,10 @@ namespace StardewModdingAPI
/// <summary>Whether the in-game world is completely unloaded and not in the process of being loaded. The world may still exist in memory at this point, but should be ignored.</summary>
internal static bool IsWorldFullyUnloaded => Context.LoadStage is LoadStage.ReturningToTitle or LoadStage.None;
+ /// <summary>If SMAPI is currently waiting for mod code, the mods to which it belongs (with the most recent at the top of the stack).</summary>
+ /// <remarks><strong>This is heuristic only.</strong> It provides a quick way to identify the most likely mod for deprecation warnings, but it should be followed with a more accurate check if needed.</remarks>
+ internal static Stack<IModMetadata> HeuristicModsRunningCode { get; } = new();
+
/*********
** Accessors