From 923e6f31aa1737183f03e61dcddcd6cc3f27b5b6 Mon Sep 17 00:00:00 2001 From: James R <justsomejames2@gmail.com> Date: Sun, 12 Sep 2021 19:01:30 -0700 Subject: [PATCH] Fix faulty comparison Logical comparisons evaluate to a boolean value... --- src/p_spec.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 8e51f788c8..8ae0ec1254 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1981,6 +1981,22 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller) } } +static boolean is_rain_type (INT32 weathernum) +{ + switch (weathernum) + { + case PRECIP_SNOW: + case PRECIP_RAIN: + case PRECIP_STORM: + case PRECIP_STORM_NOSTRIKES: + case PRECIP_BLANK: + return true; + + default: + return false; + } +} + // // P_SwitchWeather // @@ -1989,12 +2005,12 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller) void P_SwitchWeather(INT32 weathernum) { boolean purge = true; - boolean raintype = (PRECIP_SNOW || PRECIP_RAIN || PRECIP_STORM || PRECIP_STORM_NOSTRIKES || PRECIP_BLANK); if (weathernum == curWeather) return; - if (weathernum == raintype && curWeather == raintype) + if (is_rain_type(weathernum) && + is_rain_type(curWeather)) purge = false; if (purge) -- GitLab