From db7ddeee4a146defd36ac9ab3472467f849ab187 Mon Sep 17 00:00:00 2001 From: Menshin Date: Sat, 6 Apr 2019 21:36:05 +0200 Subject: [PATCH] Fix the CHECK_MULTIPLE_BITFIELDS macro (#43505) Found by TGMC people, the CHECK_MULTIPLE_BITFIELDS macro wasn't parenthesing the == rvalue, so CHECK_MULTIPLE_BITFIELDS(var, flag1 | flag 2) would come as (var & (flag 1 | flag 2)) == flag 1 | flag2 instead of (var & (flag 1 | flag 2)) == (flag 1 | flag2) making the check always pass when a second flag was checked. Only /datum/component/footstep/proc/play_footstep() was using it in that way though and it doesn't seems it was impacting it much. --- code/__DEFINES/flags.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index a5abad45ac4..0d741f97a4a 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -12,7 +12,7 @@ //check if all bitflags specified are present -#define CHECK_MULTIPLE_BITFIELDS(flagvar, flags) ((flagvar & (flags)) == flags) +#define CHECK_MULTIPLE_BITFIELDS(flagvar, flags) (((flagvar) & (flags)) == (flags)) GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768)) @@ -159,4 +159,4 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 //alternate appearance flags #define AA_TARGET_SEE_APPEARANCE (1<<0) -#define AA_MATCH_TARGET_OVERLAYS (1<<1) \ No newline at end of file +#define AA_MATCH_TARGET_OVERLAYS (1<<1)