diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-06-16 22:14:44 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-06-16 22:14:44 -0400 |
commit | 8e9237bdd7ec179975c9be5e28c811b42007e707 (patch) | |
tree | 665ca44f40e77e8f4a3af55ee442e2b3acba6434 /src/SMAPI/Metadata | |
parent | e10147e7bda94a8fbc58684246628a6520d2c6b8 (diff) | |
parent | 011aa4c9d07d6fc313d6d1ee107651778bb3c665 (diff) | |
download | SMAPI-8e9237bdd7ec179975c9be5e28c811b42007e707.tar.gz SMAPI-8e9237bdd7ec179975c9be5e28c811b42007e707.tar.bz2 SMAPI-8e9237bdd7ec179975c9be5e28c811b42007e707.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Metadata')
-rw-r--r-- | src/SMAPI/Metadata/CoreAssetPropagator.cs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 8ed6b591..b783b2b9 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -85,8 +85,8 @@ namespace StardewModdingAPI.Metadata /// <param name="assets">The asset keys and types to reload.</param> /// <param name="ignoreWorld">Whether the in-game world is fully unloaded (e.g. on the title screen), so there's no need to propagate changes into the world.</param> /// <param name="propagatedAssets">A lookup of asset names to whether they've been propagated.</param> - /// <param name="updatedNpcWarps">Whether the NPC pathfinding cache was reloaded.</param> - public void Propagate(IDictionary<IAssetName, Type> assets, bool ignoreWorld, out IDictionary<IAssetName, bool> propagatedAssets, out bool updatedNpcWarps) + /// <param name="changedWarpRoutes">Whether the NPC pathfinding warp route cache was reloaded.</param> + public void Propagate(IDictionary<IAssetName, Type> assets, bool ignoreWorld, out IDictionary<IAssetName, bool> propagatedAssets, out bool changedWarpRoutes) { // get base name lookup propagatedAssets = assets @@ -107,7 +107,7 @@ namespace StardewModdingAPI.Metadata }); // reload assets - updatedNpcWarps = false; + changedWarpRoutes = false; foreach (var bucket in buckets) { switch (bucket.Key) @@ -126,10 +126,10 @@ namespace StardewModdingAPI.Metadata foreach (var entry in bucket) { bool changed = false; - bool curChangedMapWarps = false; + bool curChangedMapRoutes = false; try { - changed = this.PropagateOther(entry.Key, entry.Value, ignoreWorld, out curChangedMapWarps); + changed = this.PropagateOther(entry.Key, entry.Value, ignoreWorld, out curChangedMapRoutes); } catch (Exception ex) { @@ -137,14 +137,14 @@ namespace StardewModdingAPI.Metadata } propagatedAssets[entry.Key] = changed; - updatedNpcWarps = updatedNpcWarps || curChangedMapWarps; + changedWarpRoutes = changedWarpRoutes || curChangedMapRoutes; } break; } } - // reload NPC pathfinding cache if any map changed - if (updatedNpcWarps) + // reload NPC pathfinding cache if any map routes changed + if (changedWarpRoutes) NPC.populateRoutesFromLocationToLocationList(); } @@ -156,14 +156,14 @@ namespace StardewModdingAPI.Metadata /// <param name="assetName">The asset name to reload.</param> /// <param name="type">The asset type to reload.</param> /// <param name="ignoreWorld">Whether the in-game world is fully unloaded (e.g. on the title screen), so there's no need to propagate changes into the world.</param> - /// <param name="changedWarps">Whether any map warps were changed as part of this propagation.</param> + /// <param name="changedWarpRoutes">Whether the locations reachable by warps from this location changed as part of this propagation.</param> /// <returns>Returns whether an asset was loaded. The return value may be true or false, or a non-null value for true.</returns> [SuppressMessage("ReSharper", "StringLiteralTypo", Justification = "These deliberately match the asset names.")] - private bool PropagateOther(IAssetName assetName, Type type, bool ignoreWorld, out bool changedWarps) + private bool PropagateOther(IAssetName assetName, Type type, bool ignoreWorld, out bool changedWarpRoutes) { var content = this.MainContentManager; string key = assetName.BaseName; - changedWarps = false; + changedWarpRoutes = false; /**** ** Special case: current map tilesheet @@ -197,7 +197,7 @@ namespace StardewModdingAPI.Metadata static ISet<string> GetWarpSet(GameLocation location) { return new HashSet<string>( - location.warps.Select(p => $"{p.X} {p.Y} {p.TargetName} {p.TargetX} {p.TargetY}") + location.warps.Select(p => p.TargetName) ); } @@ -205,7 +205,7 @@ namespace StardewModdingAPI.Metadata this.UpdateMap(info); var newWarps = GetWarpSet(location); - changedWarps = changedWarps || oldWarps.Count != newWarps.Count || oldWarps.Any(p => !newWarps.Contains(p)); + changedWarpRoutes = changedWarpRoutes || oldWarps.Count != newWarps.Count || oldWarps.Any(p => !newWarps.Contains(p)); anyChanged = true; } } |