From 59bc63cab6cd7fa80a4f46734fdaafde80e5b351 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 20 Jan 2019 01:01:26 -0500 Subject: [PATCH] propagate asset changes into the save file being loaded --- docs/release-notes.md | 4 ++-- src/SMAPI/Metadata/CoreAssetPropagator.cs | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 0081d8cf..1698b1fd 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,6 +1,5 @@ # Release notes -## Upcoming - +## Upcoming release * For players: * Added mod page link to 'missing dependency' errors for the most common dependencies. * Improved save backups: @@ -15,6 +14,7 @@ * Fixed broken ModDrop links in the compatibility list. * For modders: + * Asset changes are now propagated into the parsed save being loaded if applicable. * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index d83fc748..92968271 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -677,7 +677,13 @@ namespace StardewModdingAPI.Metadata /// Get all locations in the game. private IEnumerable GetLocations() { - foreach (GameLocation location in Game1.locations) + // get available root locations + IEnumerable rootLocations = Game1.locations; + if (SaveGame.loaded?.locations != null) + rootLocations = rootLocations.Concat(SaveGame.loaded.locations); + + // yield root + child locations + foreach (GameLocation location in rootLocations) { yield return location;