From e149f20583b90c37964c48b8f13777493611aecf Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 22 Jun 2018 16:50:15 -0400 Subject: remove seasonal tilesheet patch (#552) This is no longer needed (the changes were added to the game in SDV 1.3.19), and caused an issue since it left out the tilesheet reloading. --- src/SMAPI/Framework/Patching/GameLocationPatch.cs | 60 ----------------------- 1 file changed, 60 deletions(-) delete mode 100644 src/SMAPI/Framework/Patching/GameLocationPatch.cs (limited to 'src/SMAPI/Framework/Patching') diff --git a/src/SMAPI/Framework/Patching/GameLocationPatch.cs b/src/SMAPI/Framework/Patching/GameLocationPatch.cs deleted file mode 100644 index c0216b8f..00000000 --- a/src/SMAPI/Framework/Patching/GameLocationPatch.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Reflection; -using Harmony; -using StardewValley; -using xTile.Tiles; - -namespace StardewModdingAPI.Framework.Patching -{ - /// A Harmony patch for the method. - internal class GameLocationPatch : IHarmonyPatch - { - /********* - ** Accessors - *********/ - /// A unique name for this patch. - public string Name => $"{nameof(GameLocation)}.{nameof(GameLocation.updateSeasonalTileSheets)}"; - - - /********* - ** Public methods - *********/ - /// Apply the Harmony patch. - /// The Harmony instance. - public void Apply(HarmonyInstance harmony) - { - MethodInfo method = AccessTools.Method(typeof(GameLocation), nameof(GameLocation.updateSeasonalTileSheets)); - MethodInfo prefix = AccessTools.Method(this.GetType(), nameof(GameLocationPatch.Prefix)); - - harmony.Patch(method, new HarmonyMethod(prefix), null); - } - - - /********* - ** Private methods - *********/ - /// An implementation of which correctly handles custom map tilesheets. - /// The location instance being patched. - [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument name is defined by Harmony.")] - private static bool Prefix(GameLocation __instance) - { - if (!__instance.IsOutdoors || __instance.Name.Equals("Desert")) - return false; - foreach (TileSheet tilesheet in __instance.Map.TileSheets) - { - string imageSource = tilesheet.ImageSource; - string imageFile = Path.GetFileName(imageSource); - if (imageFile.StartsWith("spring_") || imageFile.StartsWith("summer_") || imageFile.StartsWith("fall_") || imageFile.StartsWith("winter_")) - { - string imageDir = Path.GetDirectoryName(imageSource); - if (string.IsNullOrWhiteSpace(imageDir)) - imageDir = "Maps"; - tilesheet.ImageSource = Path.Combine(imageDir, Game1.currentSeason + "_" + imageFile.Split('_')[1]); - } - } - - return false; - } - } -} -- cgit