From 13cdef2a2d877b53029bd697138f37fcdaf8274f Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 26 May 2022 00:36:19 +0100 Subject: [PATCH] VarAction2: Remove redundant and with 1 when value is already bool --- src/newgrf.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 253d1dc0cc..a4ca147fab 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -5781,6 +5781,12 @@ static void NewSpriteGroup(ByteReader *buf) inference = VA2AIF_SIGNED_NON_NEGATIVE | VA2AIF_ONE_OR_ZERO; break; } + if (prev_inference & VA2AIF_ONE_OR_ZERO) { + /* Current value is already one or zero, remove this */ + group->adjusts.pop_back(); + inference = prev_inference; + break; + } } if (adjust.and_mask <= 1) { inference = VA2AIF_SIGNED_NON_NEGATIVE | VA2AIF_ONE_OR_ZERO;