From 94cfda6832eb6bb7f75f7faff259a44d3ac364e2 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 20 Oct 2023 15:19:21 +0100 Subject: [PATCH] Self-review: TrackHazard - Fix the highest bit handling - Cleaner code for specific lap handling --- src/m_cond.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_cond.c b/src/m_cond.c index 96980e5b9..9da7e9dce 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1737,7 +1737,7 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) // Check the highest relevant byte for all necessary bits. // We only do this if an == 0xFF/0xFE check wouldn't satisfy. - if (requiredbit != 7) + if (requiredbit != (1<<7)) { // Last bit MAYBE not needed, POSITION doesn't count. const UINT8 finalbit = (requiredlap == 0) ? 1 : 0; @@ -1765,7 +1765,7 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) return (player->roundconditions.hittrackhazard[0] == 0xFE); } - return (!(player->roundconditions.hittrackhazard[requiredlap] & requiredbit) != (cn->requirement == 1)); + return (((player->roundconditions.hittrackhazard[requiredlap] & requiredbit) == requiredbit) == (cn->requirement == 1)); } case UCRP_TARGETATTACKMETHOD: