From: Mario Date: Sun, 25 Sep 2022 14:20:20 +0000 (+1000) Subject: Make the boolean macro explicitly return 1 or 0, allow compiling without -Wno-F324 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2FMario%2Fmisc_tweaks;p=xonotic%2Fxonotic-data.pk3dir.git Make the boolean macro explicitly return 1 or 0, allow compiling without -Wno-F324 --- diff --git a/qcsrc/lib/bool.qh b/qcsrc/lib/bool.qh index c78f717d9..6a9da66f0 100644 --- a/qcsrc/lib/bool.qh +++ b/qcsrc/lib/bool.qh @@ -6,7 +6,7 @@ const int false = 0; #endif -#define boolean(value) ((value) != 0) +#define boolean(value) (((value) != 0) ? 1 : 0) // get true/false value of a string with multiple different inputs ERASEABLE diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index 7d1c46f3f..0977a7d3c 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -1348,7 +1348,7 @@ spawnfunc(target_items) res = GetResource(this, RES_HEALTH); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "health"); res = GetResource(this, RES_ARMOR); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "armor"); FOREACH(StatusEffect, it.instanceOfBuff, str = sprintf("%s %s%d %s", str, valueprefix, this.buffs_finished * boolean(this.buffdef == it), it.netname)); - FOREACH(Weapons, it != WEP_Null, str = sprintf("%s %s%d %s", str, itemprefix, !!(STAT(WEAPONS, this) & (it.m_wepset)), it.netname)); + FOREACH(Weapons, it != WEP_Null, str = sprintf("%s %s%d %s", str, itemprefix, boolean(!!(STAT(WEAPONS, this) & (it.m_wepset))), it.netname)); } this.netname = strzone(str);