From 5f9c03a8a93d51202e737d1d32c21e4a2e55ff08 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 9 Feb 2017 14:28:44 -0500 Subject: add field rewriter for the `Game1.activeClickableMenu` change in SDV 1.2 (#231) --- .../Framework/BaseMethodRewriter.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs') diff --git a/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs b/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs index c9729ee8..e53e5c56 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs +++ b/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs @@ -17,13 +17,9 @@ namespace StardewModdingAPI.AssemblyRewriters.Framework /// Whether the mod was compiled on a different platform. public bool ShouldRewrite(Instruction instruction, bool platformChanged) { - // ignore non-method-call instructions if (instruction.OpCode != OpCodes.Call && instruction.OpCode != OpCodes.Callvirt) - return false; - - // check reference - MethodReference methodRef = (MethodReference)instruction.Operand; - return this.ShouldRewrite(methodRef, platformChanged); + return false; // not a method reference + return this.ShouldRewrite(instruction, (MethodReference)instruction.Operand, platformChanged); } /// Rewrite a CIL instruction for compatibility. @@ -42,9 +38,10 @@ namespace StardewModdingAPI.AssemblyRewriters.Framework ** Protected methods *********/ /// Get whether a method reference should be rewritten. + /// The IL instruction. /// The method reference. /// Whether the mod was compiled on a different platform. - protected abstract bool ShouldRewrite(MethodReference methodRef, bool platformChanged); + protected abstract bool ShouldRewrite(Instruction instruction, MethodReference methodRef, bool platformChanged); /// Rewrite a method for compatibility. /// The module being rewritten. -- cgit