summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-03-26 19:01:13 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-03-26 19:01:13 -0400
commit23443721cd2cc5391510a6e65b4e6559037e5b5e (patch)
tree882305b5a0d472701757c5af60a3fb7532530909 /src
parent06f5e92b88fac190f94690f1580775449014e411 (diff)
downloadSMAPI-23443721cd2cc5391510a6e65b4e6559037e5b5e.tar.gz
SMAPI-23443721cd2cc5391510a6e65b4e6559037e5b5e.tar.bz2
SMAPI-23443721cd2cc5391510a6e65b4e6559037e5b5e.zip
allow multiple rewriters to change the same CIL instruction (#254)
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI/Framework/AssemblyLoader.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/StardewModdingAPI/Framework/AssemblyLoader.cs b/src/StardewModdingAPI/Framework/AssemblyLoader.cs
index c7ad3da4..aee0bbb3 100644
--- a/src/StardewModdingAPI/Framework/AssemblyLoader.cs
+++ b/src/StardewModdingAPI/Framework/AssemblyLoader.cs
@@ -212,9 +212,11 @@ namespace StardewModdingAPI.Framework
}
// rewrite instruction if needed
- IInstructionRewriter rewriter = rewriters.FirstOrDefault(p => p.IsMatch(instruction, platformChanged));
- if (rewriter != null)
+ foreach (IInstructionRewriter rewriter in rewriters)
{
+ if (!rewriter.IsMatch(instruction, platformChanged))
+ continue;
+
this.LogOnce(this.Monitor, loggedMessages, $"Rewriting {assembly.Name.Name} to fix {rewriter.NounPhrase}...");
rewriter.Rewrite(module, cil, instruction, this.AssemblyMap);
anyRewritten = true;