From: terencehill Date: Fri, 5 Jun 2020 16:44:11 +0000 (+0200) Subject: Make precedence explicit in expressions where || and && are mixed (patch by martin-t) X-Git-Tag: xonotic-v0.8.5~944 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2e0bcaa89c89e3495f39242470ecee01ab8b9e12;p=xonotic%2Fxonotic-data.pk3dir.git Make precedence explicit in expressions where || and && are mixed (patch by martin-t) --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 5b07cdb21..1f8eb8a69 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -2005,7 +2005,7 @@ void View_PostProcessing() 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; diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 208070887..15e1afe58 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -478,7 +478,7 @@ void CheckPlayerJump(entity this) 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)) { } diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 3237fd437..fc11cfab2 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -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) ( \ - (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)) diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index ff663e304..942863e70 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -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 ); } - 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); diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 760162e31..eda0838fd 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -560,7 +560,7 @@ float CheatCommand(entity this, int argc) 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; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 3c56b1363..a0f5c8a38 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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))) - || (!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);