diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-02 19:13:27 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-02 19:13:27 -0400 |
commit | 546b58778c9e1e983f1682f1b89cbc353939d9ea (patch) | |
tree | 7bc289cf525e01ff7a59056734623237b9598723 /src/SMAPI/Framework/Utilities | |
parent | f58cdde981f7dfabb5783c80b29f4996d76cec30 (diff) | |
download | SMAPI-546b58778c9e1e983f1682f1b89cbc353939d9ea.tar.gz SMAPI-546b58778c9e1e983f1682f1b89cbc353939d9ea.tar.bz2 SMAPI-546b58778c9e1e983f1682f1b89cbc353939d9ea.zip |
switch to 'processing tick' for tick caching
This is incremented on each low-level tick (whether it's a game update, synchronized async operation, etc). That mainly avoids the cache persisting across the entire save loading process while it's being synchronized.
Diffstat (limited to 'src/SMAPI/Framework/Utilities')
-rw-r--r-- | src/SMAPI/Framework/Utilities/TickCacheDictionary.cs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/SMAPI/Framework/Utilities/TickCacheDictionary.cs b/src/SMAPI/Framework/Utilities/TickCacheDictionary.cs index 5921e089..d0f276d2 100644 --- a/src/SMAPI/Framework/Utilities/TickCacheDictionary.cs +++ b/src/SMAPI/Framework/Utilities/TickCacheDictionary.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using StardewValley; namespace StardewModdingAPI.Framework.Utilities { @@ -28,10 +27,10 @@ namespace StardewModdingAPI.Framework.Utilities public TValue GetOrSet(TKey cacheKey, Func<TValue> get) { // clear cache on new tick - if (SCore.TicksElapsed != this.LastGameTick) + if (SCore.ProcessTicksElapsed != this.LastGameTick) { this.Cache.Clear(); - this.LastGameTick = SCore.TicksElapsed; + this.LastGameTick = SCore.ProcessTicksElapsed; } // fetch value |