summaryrefslogtreecommitdiff
path: root/src/SMAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-01-12 20:00:40 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-01-12 20:00:40 -0500
commitd47d850753ec19d82993c5e2af8a17ca729c43a7 (patch)
tree8200f49902657a73c21995a815ef3e0702747d55 /src/SMAPI
parentaab4ddf05ed825d043330c5d65f7d3503b8b02fb (diff)
downloadSMAPI-d47d850753ec19d82993c5e2af8a17ca729c43a7.tar.gz
SMAPI-d47d850753ec19d82993c5e2af8a17ca729c43a7.tar.bz2
SMAPI-d47d850753ec19d82993c5e2af8a17ca729c43a7.zip
tuck location map reload into method (#751)
Diffstat (limited to 'src/SMAPI')
-rw-r--r--src/SMAPI/Metadata/CoreAssetPropagator.cs66
1 files changed, 36 insertions, 30 deletions
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs
index b82dedfd..bd1cc50e 100644
--- a/src/SMAPI/Metadata/CoreAssetPropagator.cs
+++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs
@@ -138,36 +138,7 @@ namespace StardewModdingAPI.Metadata
{
if (!string.IsNullOrWhiteSpace(location.mapPath.Value) && this.NormalizeAssetNameIgnoringEmpty(location.mapPath.Value) == key)
{
- // reset patch caches
- switch (location)
- {
- case Town _:
- this.Reflection.GetField<bool>(location, "ccRefurbished").SetValue(false);
- this.Reflection.GetField<bool>(location, "isShowingDestroyedJoja").SetValue(false);
- this.Reflection.GetField<bool>(location, "isShowingUpgradedPamHouse").SetValue(false);
- break;
-
- case Beach _:
- case BeachNightMarket _:
- case Forest _:
- this.Reflection.GetField<bool>(location, "hasShownCCUpgrade").SetValue(false);
- break;
- }
-
- // general updates
- location.reloadMap();
- location.updateSeasonalTileSheets();
- location.updateWarps();
-
- // update interior doors
- location.interiorDoors.Clear();
- foreach (var entry in new InteriorDoorDictionary(location))
- location.interiorDoors.Add(entry);
-
- // update doors
- location.doors.Clear();
- location.updateDoors();
-
+ this.ReloadMap(location);
anyChanged = true;
}
}
@@ -803,6 +774,41 @@ namespace StardewModdingAPI.Metadata
return true;
}
+ /// <summary>Reload the map for a location.</summary>
+ /// <param name="location">The location whose map to reload.</param>
+ private void ReloadMap(GameLocation location)
+ {
+ // reset patch caches
+ switch (location)
+ {
+ case Town _:
+ this.Reflection.GetField<bool>(location, "ccRefurbished").SetValue(false);
+ this.Reflection.GetField<bool>(location, "isShowingDestroyedJoja").SetValue(false);
+ this.Reflection.GetField<bool>(location, "isShowingUpgradedPamHouse").SetValue(false);
+ break;
+
+ case Beach _:
+ case BeachNightMarket _:
+ case Forest _:
+ this.Reflection.GetField<bool>(location, "hasShownCCUpgrade").SetValue(false);
+ break;
+ }
+
+ // general updates
+ location.reloadMap();
+ location.updateSeasonalTileSheets();
+ location.updateWarps();
+
+ // update interior doors
+ location.interiorDoors.Clear();
+ foreach (var entry in new InteriorDoorDictionary(location))
+ location.interiorDoors.Add(entry);
+
+ // update doors
+ location.doors.Clear();
+ location.updateDoors();
+ }
+
/// <summary>Reload the disposition data for matching NPCs.</summary>
/// <param name="content">The content manager through which to reload the asset.</param>
/// <param name="key">The asset key to reload.</param>