summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/StateTracking/LocationTracker.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-01-01 00:13:59 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-01-01 00:13:59 -0500
commit844efa32d49baa2ca58332cd26bbbe3cc772ad22 (patch)
treedfb74e5da8140a86b867ccf1b4210320c2edba0a /src/SMAPI/Framework/StateTracking/LocationTracker.cs
parent6bf99f0f81582ab6d6212dc21e8c36686ceb5a35 (diff)
downloadSMAPI-844efa32d49baa2ca58332cd26bbbe3cc772ad22.tar.gz
SMAPI-844efa32d49baa2ca58332cd26bbbe3cc772ad22.tar.bz2
SMAPI-844efa32d49baa2ca58332cd26bbbe3cc772ad22.zip
optimize chest watchers using net events
Diffstat (limited to 'src/SMAPI/Framework/StateTracking/LocationTracker.cs')
-rw-r--r--src/SMAPI/Framework/StateTracking/LocationTracker.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/StateTracking/LocationTracker.cs b/src/SMAPI/Framework/StateTracking/LocationTracker.cs
index 7445add9..519fe8f4 100644
--- a/src/SMAPI/Framework/StateTracking/LocationTracker.cs
+++ b/src/SMAPI/Framework/StateTracking/LocationTracker.cs
@@ -109,6 +109,9 @@ namespace StardewModdingAPI.Framework.StateTracking
{
foreach (IWatcher watcher in this.Watchers)
watcher.Dispose();
+
+ foreach (var watcher in this.ChestWatchers.Values)
+ watcher.Dispose();
}
@@ -124,7 +127,10 @@ namespace StardewModdingAPI.Framework.StateTracking
foreach (KeyValuePair<Vector2, SObject> pair in removed)
{
if (pair.Value is Chest && this.ChestWatchers.TryGetValue(pair.Key, out ChestTracker watcher))
+ {
+ watcher.Dispose();
this.ChestWatchers.Remove(pair.Key);
+ }
}
// add new watchers