diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-01-01 00:13:59 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-01-01 00:13:59 -0500 |
commit | 844efa32d49baa2ca58332cd26bbbe3cc772ad22 (patch) | |
tree | dfb74e5da8140a86b867ccf1b4210320c2edba0a /src/SMAPI/Framework/StateTracking/LocationTracker.cs | |
parent | 6bf99f0f81582ab6d6212dc21e8c36686ceb5a35 (diff) | |
download | SMAPI-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.cs | 6 |
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 |