summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-12-07 16:17:45 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-12-07 16:17:45 -0500
commit8ff41110275facadf6dca2814047e8aa6f4a26fa (patch)
tree6d70491ad29fc9304de8eaecdb2c995e8acf8160 /src/SMAPI/Framework
parenta78b1935928919694dfe8de823a1accd6d222732 (diff)
downloadSMAPI-8ff41110275facadf6dca2814047e8aa6f4a26fa.tar.gz
SMAPI-8ff41110275facadf6dca2814047e8aa6f4a26fa.tar.bz2
SMAPI-8ff41110275facadf6dca2814047e8aa6f4a26fa.zip
fix crash when constucting buildings that have an interior
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs b/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs
index d9d598f8..930a8102 100644
--- a/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs
+++ b/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs
@@ -62,9 +62,13 @@ namespace StardewModdingAPI.Framework.StateTracking
/// <summary>Update the current value if needed.</summary>
public void Update()
{
- // detect added/removed locations
+ // update watchers
this.LocationListWatcher.Update();
this.MineLocationListWatcher.Update();
+ foreach (LocationTracker watcher in this.Locations)
+ watcher.Update();
+
+ // detect added/removed locations
if (this.LocationListWatcher.IsChanged)
{
this.Remove(this.LocationListWatcher.Removed);
@@ -77,14 +81,10 @@ namespace StardewModdingAPI.Framework.StateTracking
}
// detect building changed
- foreach (LocationTracker watcher in this.Locations.ToArray())
+ foreach (LocationTracker watcher in this.Locations.Where(p => p.BuildingsWatcher.IsChanged).ToArray())
{
- watcher.Update();
- if (watcher.BuildingsWatcher.IsChanged)
- {
- this.Remove(watcher.BuildingsWatcher.Removed);
- this.Add(watcher.BuildingsWatcher.Added);
- }
+ this.Remove(watcher.BuildingsWatcher.Removed);
+ this.Add(watcher.BuildingsWatcher.Added);
}
// detect building interiors changed (e.g. construction completed)