From c5cfcc6c9ff36a7fc05916de95889c21dc6849ea Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 1 Jan 2020 00:22:29 -0500 Subject: [PATCH] fix location snapshot not updated for removed chests --- .../StateTracking/Snapshots/LocationSnapshot.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs b/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs index 4e08a1ac..edfba736 100644 --- a/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs +++ b/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs @@ -63,13 +63,12 @@ namespace StardewModdingAPI.Framework.StateTracking.Snapshots this.TerrainFeatures.Update(watcher.TerrainFeaturesWatcher); // chest inventories - foreach (var pair in watcher.ChestWatchers) + this.ChestItems.Clear(); + foreach (ChestTracker tracker in watcher.ChestWatchers.Values) { - ItemStackChange[] changes = pair.Value.GetInventoryChanges().ToArray(); + ItemStackChange[] changes = tracker.GetInventoryChanges().ToArray(); if (changes.Length > 0) - this.ChestItems[pair.Value.Chest] = changes; - else - this.ChestItems.Remove(pair.Value.Chest); + this.ChestItems[tracker.Chest] = changes; } } }