]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make precedence explicit in expressions where || and && are mixed (patch by martin-t)
authorterencehill <piuntn@gmail.com>
Fri, 5 Jun 2020 16:44:11 +0000 (18:44 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 5 Jun 2020 16:46:50 +0000 (18:46 +0200)
qcsrc/client/view.qc
qcsrc/common/physics/player.qc
qcsrc/common/physics/player.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/server/cheats.qc
qcsrc/server/client.qc

index 5b07cdb210e10387aea491e5f713f7cdb3de07b5..1f8eb8a69466a1d44c8a1be6972068cdd73125eb 100644 (file)
@@ -2005,7 +2005,7 @@ void View_PostProcessing()
 
 void View_Lock()
 {
 
 void View_Lock()
 {
-       int lock_type = (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1 || QuickMenu_IsOpened()));
+       int lock_type = (!autocvar_hud_cursormode && ((autocvar__hud_configure && spectatee_status <= 0) || intermission > 1 || QuickMenu_IsOpened()));
        if (lock_type == 0)
                lock_type = autocvar_cl_lockview;
 
        if (lock_type == 0)
                lock_type = autocvar_cl_lockview;
 
index 208070887fa6f087ef54d86472225c7672f82212..15e1afe58a1d2c2d7b6bb60e24281389c97ed028 100644 (file)
@@ -478,7 +478,7 @@ void CheckPlayerJump(entity this)
                bool playerjump = PlayerJump(this); // required
 
                bool air_jump = !playerjump || M_ARGV(2, bool);
                bool playerjump = PlayerJump(this); // required
 
                bool air_jump = !playerjump || M_ARGV(2, bool);
-               bool activate = JETPACK_JUMP(this) && air_jump && PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_JETPACK(this);
+               bool activate = (JETPACK_JUMP(this) && air_jump && PHYS_INPUT_BUTTON_JUMP(this)) || PHYS_INPUT_BUTTON_JETPACK(this);
                bool has_fuel = !PHYS_JETPACK_FUEL(this) || PHYS_AMMO_FUEL(this) || (ITEMS_STAT(this) & IT_UNLIMITED_AMMO);
 
                if (!(ITEMS_STAT(this) & ITEM_Jetpack.m_itemid)) { }
                bool has_fuel = !PHYS_JETPACK_FUEL(this) || PHYS_AMMO_FUEL(this) || (ITEMS_STAT(this) & IT_UNLIMITED_AMMO);
 
                if (!(ITEMS_STAT(this) & ITEM_Jetpack.m_itemid)) { }
index 3237fd43728429d767e9d7d1d5f0a877e3347bbf..fc11cfab263185de02d7ccd67f3ce06069693fe3 100644 (file)
@@ -135,17 +135,17 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
 // used for special commands and idle checking, not from the engine
 // TODO: cache
 #define PHYS_INPUT_BUTTON_MASK(s) ( \
 // used for special commands and idle checking, not from the engine
 // TODO: cache
 #define PHYS_INPUT_BUTTON_MASK(s) ( \
-         (1 <<  0) * PHYS_INPUT_BUTTON_ATCK(s) \
-       | (1 <<  1) * PHYS_INPUT_BUTTON_JUMP(s) \
-       | (1 <<  2) * PHYS_INPUT_BUTTON_ATCK2(s) \
-       | (1 <<  3) * PHYS_INPUT_BUTTON_ZOOM(s) \
-       | (1 <<  4) * PHYS_INPUT_BUTTON_CROUCH(s) \
-       | (1 <<  5) * PHYS_INPUT_BUTTON_HOOK(s) \
-       | (1 <<  6) * PHYS_INPUT_BUTTON_USE(s) \
-       | (1 <<  7) * PHYS_INPUT_BUTTON_BACKWARD(s) \
-       | (1 <<  8) * PHYS_INPUT_BUTTON_FORWARD(s) \
-       | (1 <<  9) * PHYS_INPUT_BUTTON_LEFT(s) \
-       | (1 << 10) * PHYS_INPUT_BUTTON_RIGHT(s) \
+         ((1 <<  0) * PHYS_INPUT_BUTTON_ATCK(s)) \
+       | ((1 <<  1) * PHYS_INPUT_BUTTON_JUMP(s)) \
+       | ((1 <<  2) * PHYS_INPUT_BUTTON_ATCK2(s)) \
+       | ((1 <<  3) * PHYS_INPUT_BUTTON_ZOOM(s)) \
+       | ((1 <<  4) * PHYS_INPUT_BUTTON_CROUCH(s)) \
+       | ((1 <<  5) * PHYS_INPUT_BUTTON_HOOK(s)) \
+       | ((1 <<  6) * PHYS_INPUT_BUTTON_USE(s)) \
+       | ((1 <<  7) * PHYS_INPUT_BUTTON_BACKWARD(s)) \
+       | ((1 <<  8) * PHYS_INPUT_BUTTON_FORWARD(s)) \
+       | ((1 <<  9) * PHYS_INPUT_BUTTON_LEFT(s)) \
+       | ((1 << 10) * PHYS_INPUT_BUTTON_RIGHT(s)) \
        )
 
 #define IS_JUMP_HELD(s)                     (!((s).flags & FL_JUMPRELEASED))
        )
 
 #define IS_JUMP_HELD(s)                     (!((s).flags & FL_JUMPRELEASED))
index ff663e3045b76e63c9794b441de08fa26ec0e579..942863e701bb3bf9ffaf13d8998544e988bd6ace 100644 (file)
@@ -583,8 +583,9 @@ void Arc_Smoke(Weapon thiswep, entity actor, .entity weaponentity, int fire)
                        Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
        }
 
                        Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
        }
 
-       if (  actor.arc_smoke_sound && ( actor.arc_overheat <= time ||
-               !( PHYS_INPUT_BUTTON_ATCK(actor) || PHYS_INPUT_BUTTON_ATCK2(actor) ) ) || actor.(weaponentity).m_switchweapon != thiswep )
+       bool attacking = PHYS_INPUT_BUTTON_ATCK(actor) || PHYS_INPUT_BUTTON_ATCK2(actor);
+       bool stop_smoke_sound = actor.arc_overheat <= time || !attacking;
+       if ((actor.arc_smoke_sound && stop_smoke_sound) || actor.(weaponentity).m_switchweapon != thiswep)
        {
                actor.arc_smoke_sound = 0;
                sound(actor, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
        {
                actor.arc_smoke_sound = 0;
                sound(actor, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
index 760162e313f2e87933654f9236435b0e53f827dd..eda0838fd24e61d6a9a34078a936edefba74f15f 100644 (file)
@@ -560,7 +560,7 @@ float CheatCommand(entity this, int argc)
                                        effectnum = 0;
                                        for(entity ent = NULL; (ent = find(ent, classname, "dragbox_box")); )
                                        {
                                        effectnum = 0;
                                        for(entity ent = NULL; (ent = find(ent, classname, "dragbox_box")); )
                                        {
-                                               if(e.cnt <= 0 && ent.cnt == 0 || e.cnt == ent.cnt)
+                                               if((e.cnt <= 0 && ent.cnt == 0) || e.cnt == ent.cnt)
                                                {
                                                        start = start + ent.origin;
                                                        ++effectnum;
                                                {
                                                        start = start + ent.origin;
                                                        ++effectnum;
index 3c56b1363b56cf489d8af80b7562b6a8b9a01c98..a0f5c8a38fc4e61c0457fd3549a6a40bb07a83ab 100644 (file)
@@ -2291,7 +2291,7 @@ void ObserverOrSpectatorThink(entity this)
                        this.flags &= ~FL_JUMPRELEASED;
                        this.flags |= FL_SPAWNING;
                } else if((is_spec && (PHYS_INPUT_BUTTON_ATCK(this) || CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18 || (CS(this).impulse >= 200 && CS(this).impulse <= 209)))
                        this.flags &= ~FL_JUMPRELEASED;
                        this.flags |= FL_SPAWNING;
                } else if((is_spec && (PHYS_INPUT_BUTTON_ATCK(this) || CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18 || (CS(this).impulse >= 200 && CS(this).impulse <= 209)))
-                       || (!is_spec && (PHYS_INPUT_BUTTON_ATCK(this) && !CS(this).version_mismatch || this.would_spectate))) {
+                       || (!is_spec && ((PHYS_INPUT_BUTTON_ATCK(this) && !CS(this).version_mismatch) || this.would_spectate))) {
                        this.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext(this)) {
                                TRANSMUTE(Spectator, this);
                        this.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext(this)) {
                                TRANSMUTE(Spectator, this);