diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-04-14 22:14:43 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-09-13 15:29:08 -0400 |
commit | e43f01ffce7238d40d275c47615c24b9134b4954 (patch) | |
tree | 303b91a4d0f5afa2c66ef043b8c636b6476937ec /src/SMAPI/Patches/LoadForNewGamePatch.cs | |
parent | 36efdcfce2c76df2dd5313f6a42ddb76467cf610 (diff) | |
download | SMAPI-e43f01ffce7238d40d275c47615c24b9134b4954.tar.gz SMAPI-e43f01ffce7238d40d275c47615c24b9134b4954.tar.bz2 SMAPI-e43f01ffce7238d40d275c47615c24b9134b4954.zip |
tweak patch code style
Diffstat (limited to 'src/SMAPI/Patches/LoadForNewGamePatch.cs')
-rw-r--r-- | src/SMAPI/Patches/LoadForNewGamePatch.cs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/SMAPI/Patches/LoadForNewGamePatch.cs b/src/SMAPI/Patches/LoadForNewGamePatch.cs index f4ce2023..def7134d 100644 --- a/src/SMAPI/Patches/LoadForNewGamePatch.cs +++ b/src/SMAPI/Patches/LoadForNewGamePatch.cs @@ -1,7 +1,6 @@ using System; using System.Collections.ObjectModel; using System.Collections.Specialized; -using System.Reflection; using Harmony; using StardewModdingAPI.Enums; using StardewModdingAPI.Framework.Patching; @@ -28,7 +27,7 @@ namespace StardewModdingAPI.Patches private static bool IsCreating; /// <summary>The number of times that <see cref="Game1.locations"/> has been cleared since <see cref="Game1.loadForNewGame"/> started.</summary> - private static int TimesLocationsCleared = 0; + private static int TimesLocationsCleared; /********* @@ -54,11 +53,11 @@ namespace StardewModdingAPI.Patches /// <param name="harmony">The Harmony instance.</param> public void Apply(HarmonyInstance harmony) { - MethodInfo method = AccessTools.Method(typeof(Game1), nameof(Game1.loadForNewGame)); - MethodInfo prefix = AccessTools.Method(this.GetType(), nameof(LoadForNewGamePatch.Prefix)); - MethodInfo postfix = AccessTools.Method(this.GetType(), nameof(LoadForNewGamePatch.Postfix)); - - harmony.Patch(method, new HarmonyMethod(prefix), new HarmonyMethod(postfix)); + harmony.Patch( + original: AccessTools.Method(typeof(Game1), nameof(Game1.loadForNewGame)), + prefix: new HarmonyMethod(this.GetType(), nameof(LoadForNewGamePatch.Prefix)), + postfix: new HarmonyMethod(this.GetType(), nameof(LoadForNewGamePatch.Postfix)) + ); } @@ -89,7 +88,7 @@ namespace StardewModdingAPI.Patches if (LoadForNewGamePatch.IsCreating) { // clean up - ObservableCollection<GameLocation> locations = (ObservableCollection<GameLocation>) Game1.locations; + ObservableCollection<GameLocation> locations = (ObservableCollection<GameLocation>)Game1.locations; locations.CollectionChanged -= LoadForNewGamePatch.OnLocationListChanged; // raise stage changed |