]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Wrap some statuses with parentesis to avoid possible obscure bugs
authorLegendaryGuard <rootuser999@gmail.com>
Fri, 4 Aug 2023 23:07:08 +0000 (01:07 +0200)
committerLegendaryGuard <rootuser999@gmail.com>
Fri, 4 Aug 2023 23:07:08 +0000 (01:07 +0200)
qcsrc/client/hud/panel/strafehud.qc
qcsrc/client/hud/panel/weapons.qc
qcsrc/client/items/items.qc
qcsrc/client/main.qc
qcsrc/common/effects/qc/casings.qc
qcsrc/common/mapobjects/teleporters.qc
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/common/mapobjects/trigger/teleport.qc

index 075dfb3711bed22b957f3723c44e65ae06865f56..0dd48716f3e97be57fb7c89ae0c9c613b0b9bf71 100644 (file)
@@ -214,7 +214,7 @@ void HUD_StrafeHUD()
                        {
                                trace_dphitq3surfaceflags = 0;
                                tracebox(strafeplayer.origin, strafeplayer.mins, strafeplayer.maxs, strafeplayer.origin - '0 0 1', MOVE_NOMONSTERS, strafeplayer);
-                               onslick = trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK;
+                               onslick = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK);
                        }
                        real_onslick = onslick;
 
@@ -333,7 +333,7 @@ void HUD_StrafeHUD()
                }
                else // alternatively calculate wishdir by querying pressed keys
                {
-                       if(keys & KEY_FORWARD || keys & KEY_BACKWARD)
+                       if((keys & KEY_FORWARD) || (keys & KEY_BACKWARD))
                                wishangle = 45;
                        else
                                wishangle = 90;
@@ -806,7 +806,8 @@ void HUD_StrafeHUD()
                                        slickoffset.y = cos(j * DEG2RAD) * slickrotate;
 
                                        traceline(traceorigin, traceorigin + slickoffset, MOVE_NOMONSTERS, strafeplayer);
-                                       if((PHYS_FRICTION(strafeplayer) == 0 && trace_fraction < 1) || trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK)
+                                       if((PHYS_FRICTION(strafeplayer) == 0 && trace_fraction < 1) 
+                                       || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK))
                                                slickdetected = true;
                                        if(i == 0)
                                                break;
index b51c5761d77819902787d194525dd2301093b751..dde130da8a2b94420007d646c839e8243c44de38 100644 (file)
@@ -499,7 +499,7 @@ void HUD_Weapons()
                }
                else
                {
-                       if (it.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK)
+                       if ((it.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK))
                                && !(weapons_stat & WepSet_FromWeapon(it)))
                        {
                                continue;
index 1b03ba8fc22443dbd100ebb101b3e7be3d906abe..dba2c8ffcd15fbcbabda8296e7646b0d47a9fd08 100644 (file)
@@ -75,12 +75,12 @@ void ItemSetModel(entity this, bool wantsimple)
 
 void ItemDraw(entity this)
 {
-       bool wantsimple = autocvar_cl_simple_items && this.ItemStatus & ITS_ALLOWSI;
+       bool wantsimple = autocvar_cl_simple_items && (this.ItemStatus & ITS_ALLOWSI);
        if(wantsimple != this.item_simple && this.item_simple != -1)
                ItemSetModel(this, wantsimple);
 
        // no bobbing applied to simple items, for consistency's sake (no visual difference between ammo and weapons)
-       bool animate = autocvar_cl_items_animate & 1 && this.item_simple <= 0 && (this.ItemStatus & ITS_ANIMATE1 || this.ItemStatus & ITS_ANIMATE2);
+       bool animate = (autocvar_cl_items_animate & 1) && this.item_simple <= 0 && ((this.ItemStatus & ITS_ANIMATE1) || (this.ItemStatus & ITS_ANIMATE2));
 
        // rotation must be set before running physics
        if(!animate)
@@ -201,7 +201,7 @@ void ItemDraw(entity this)
                if(autocvar_cl_items_animate & 2)
                        this.alpha *= (this.wait - time) / IT_DESPAWNFX_TIME;
 
-               if(autocvar_cl_items_animate & 4 && time >= this.pointtime)
+               if((autocvar_cl_items_animate & 4) && time >= this.pointtime)
                {
                        pointparticles(EFFECT_ITEM_DESPAWN, this.origin + '0 0 16', '0 0 0', 1);
                        if (this.delay > 0.0625)
@@ -275,7 +275,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
 
                        if(this.ItemStatus & ITS_GLOW)
                                this.effects &= ~(EF_ADDITIVE | EF_FULLBRIGHT);
-                       if(prevItemStatus & ITS_AVAILABLE && this.alpha)
+                       if((prevItemStatus & ITS_AVAILABLE) && this.alpha)
                                pointparticles(EFFECT_ITEM_PICKUP, (this.absmin + this.absmax) * 0.5, '0 0 0', 1);
                }
        }
index 58d497aab77b176a9ef60b951762e60d7eecac95..5f2332c69096896ce639fce443df27d95eca1362 100644 (file)
@@ -744,7 +744,7 @@ NET_HANDLE(ENT_CLIENT_NAGGER, bool isnew)
                for(int i = 0; i < maxclients;)
                        for(int f = ReadByte(), b = 0; b < 8 && i < maxclients; ++b, ++i)
                                if(playerslots[i])
-                                       playerslots[i].ready = f & BIT(b);
+                                       playerslots[i].ready = (f & BIT(b));
 
        return = true;
 
index b49ff60faceaccb3b46a88cde7ad1825907c684c..a61a8bd093b3ec039bc817d2982a71b854c0bdc8 100644 (file)
@@ -164,8 +164,8 @@ NET_HANDLE(casings, bool isNew)
 
     return = true;
 
-    casing.silent = casing.state & 0x80;
-    if (casing.state & 0x40 && !autocvar_chase_active)
+    casing.silent = (casing.state & 0x80);
+    if ((casing.state & 0x40) && !autocvar_chase_active)
         casing.origin += autocvar_cl_gunoffset.x * v_forward
                        - autocvar_cl_gunoffset.y * v_right
                        + autocvar_cl_gunoffset.z * v_up;
index b9698446c2e67f6b4b9d214e047a3559d5a1c50d..651566c71b6fbec9ff4fd7ef5052a14dea7919ce 100644 (file)
@@ -223,8 +223,8 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
                if(vdist(player.velocity, >, e.speed))
                        player.velocity = normalize(player.velocity) * max(0, e.speed);
 
-       if(!(teleporter.classname == "trigger_teleport" && teleporter.spawnflags & TELEPORT_KEEP_SPEED) &&
-          !(teleporter.classname == "target_teleporter" && teleporter.spawnflags & TARGET_TELEPORTER_KEEP_SPEED))
+       if(!(teleporter.classname == "trigger_teleport" && (teleporter.spawnflags & TELEPORT_KEEP_SPEED)) &&
+          !(teleporter.classname == "target_teleporter" && (teleporter.spawnflags & TARGET_TELEPORTER_KEEP_SPEED)))
                if(STAT(TELEPORT_MAXSPEED, player))
                        if(vdist(player.velocity, >, STAT(TELEPORT_MAXSPEED, player)))
                                player.velocity = normalize(player.velocity) * max(0, STAT(TELEPORT_MAXSPEED, player));
index 98498de1c7caa73f50affa3c79631668d63857d5..82f7088e57c54245fb2c0b9f0cda1ef39cf01b96 100644 (file)
@@ -249,7 +249,7 @@ bool jumppad_push(entity this, entity targ, bool is_velocity_pad)
 
        vector org = targ.origin;
 
-       if(Q3COMPAT_COMMON || this.spawnflags & PUSH_STATIC)
+       if(Q3COMPAT_COMMON || (this.spawnflags & PUSH_STATIC))
                org = (this.absmin + this.absmax) * 0.5;
 
        bool already_pushed = false;
index b581db0617762dd13353dbe64cdc25028d9a58c9..cc8189a032a715edc97dd2d5fc5b5ce28f933ca7 100644 (file)
@@ -40,7 +40,7 @@ bool Teleport_Active(entity this, entity player)
                        return false;
 
        // no need to call IS_OBSERVER(), observers never call use/touch functions which means this is never an observer
-       if(this.classname == "trigger_teleport" && this.spawnflags & TELEPORT_OBSERVERS_ONLY)
+       if(this.classname == "trigger_teleport" && (this.spawnflags & TELEPORT_OBSERVERS_ONLY))
                return false;
 
        return true;