From: Mario Date: Tue, 19 May 2020 16:55:30 +0000 (+1000) Subject: Fix some cases of missing parenthesis in bitflag checks X-Git-Tag: xonotic-v0.8.5~1059 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=abb8a9c9d25666514ccdb8554c88e968142c2c2d;p=xonotic%2Fxonotic-data.pk3dir.git Fix some cases of missing parenthesis in bitflag checks --- diff --git a/qcsrc/lib/intrusivelist.qh b/qcsrc/lib/intrusivelist.qh index 279210fb1..be3fb00fa 100644 --- a/qcsrc/lib/intrusivelist.qh +++ b/qcsrc/lib/intrusivelist.qh @@ -248,7 +248,7 @@ void ONREMOVE(entity this) if (this.il_lists) { for (int i = 0; i < IL_MAX; ++i) { IntrusiveList list = il_links[i]; - if (this.il_lists & list.il_listmask && IL_CONTAINS(list, this)) { + if ((this.il_lists & list.il_listmask) && IL_CONTAINS(list, this)) { IL_REMOVE(list, this); } } diff --git a/qcsrc/menu/xonotic/maplist.qc b/qcsrc/menu/xonotic/maplist.qc index 5184ee1fd..a18037db6 100644 --- a/qcsrc/menu/xonotic/maplist.qc +++ b/qcsrc/menu/xonotic/maplist.qc @@ -365,11 +365,11 @@ float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift) if(MapInfo_FindName_firstResult >= 0) me.setSelected(me, MapInfo_FindName_firstResult); } - else if(shift & S_CTRL && scan == 'f') // ctrl-f (as in "F"ind) + else if((shift & S_CTRL) && scan == 'f') // ctrl-f (as in "F"ind) { me.parent.setFocus(me.parent, me.stringFilterBox); } - else if(shift & S_CTRL && scan == 'u') // ctrl-u (remove stringFilter line + else if((shift & S_CTRL) && scan == 'u') // ctrl-u (remove stringFilter line { me.stringFilterBox.setText(me.stringFilterBox, ""); MapList_StringFilterBox_Change(me.stringFilterBox, me); diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index aee350635..6515cc44e 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -956,7 +956,7 @@ void havocbot_movetogoal(entity this) { if (vlen2(flat_diff) < vlen2(offset)) { - if (this.goalcurrent.wpflags & WAYPOINTFLAG_JUMP && this.goalstack01) + if ((this.goalcurrent.wpflags & WAYPOINTFLAG_JUMP) && this.goalstack01) { // oblique warpzones need a jump otherwise bots gets stuck PHYS_INPUT_BUTTON_JUMP(this) = true; diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 1f5377bb3..ebc18a687 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1654,7 +1654,7 @@ int navigation_poptouchedgoals(entity this) if(this.lastteleporttime > 0 && TELEPORT_USED(this, this.goalcurrent)) { if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING) - if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this) + if((this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL) && this.goalcurrent.owner==this) { this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING; this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED; @@ -1696,7 +1696,7 @@ int navigation_poptouchedgoals(entity this) if (tele_ent && TELEPORT_USED(this, tele_ent)) { if (this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING) - if (tele_ent.wpflags & WAYPOINTFLAG_PERSONAL && tele_ent.owner == this) + if ((tele_ent.wpflags & WAYPOINTFLAG_PERSONAL) && tele_ent.owner == this) { this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING; this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED; @@ -1718,7 +1718,7 @@ int navigation_poptouchedgoals(entity this) // Loose goal touching check when running // check goalstack01 to make sure waypoint isn't the final goal - if(this.aistatus & AI_STATUS_RUNNING && this.goalcurrent.classname == "waypoint" && !(this.goalcurrent.wpflags & WAYPOINTFLAG_JUMP) + if((this.aistatus & AI_STATUS_RUNNING) && this.goalcurrent.classname == "waypoint" && !(this.goalcurrent.wpflags & WAYPOINTFLAG_JUMP) && this.goalstack01 && !wasfreed(this.goalstack01) && vdist(vec2(this.velocity), >=, autocvar_sv_maxspeed)) { vector gco = this.goalcurrent.origin; @@ -1733,7 +1733,7 @@ int navigation_poptouchedgoals(entity this) { // Detect personal waypoints if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING) - if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this) + if((this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL) && this.goalcurrent.owner==this) { this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING; this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED; @@ -1769,7 +1769,7 @@ int navigation_poptouchedgoals(entity this) // Detect personal waypoints if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING) - if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this) + if((this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL) && this.goalcurrent.owner==this) { this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING; this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED; diff --git a/qcsrc/server/bot/default/scripting.qc b/qcsrc/server/bot/default/scripting.qc index 176b6361d..9c2c6825d 100644 --- a/qcsrc/server/bot/default/scripting.qc +++ b/qcsrc/server/bot/default/scripting.qc @@ -1211,12 +1211,12 @@ float bot_execute_commands_once(entity this) // Handle conditions if (!(bot_cmd.bot_cmd_type==BOT_CMD_FI||bot_cmd.bot_cmd_type==BOT_CMD_ELSE)) - if(this.bot_cmd_condition_status & CMD_CONDITION_true && this.bot_cmd_condition_status & CMD_CONDITION_false_BLOCK) + if((this.bot_cmd_condition_status & CMD_CONDITION_true) && this.bot_cmd_condition_status & CMD_CONDITION_false_BLOCK) { bot_command_executed(this, true); return -1; } - else if(this.bot_cmd_condition_status & CMD_CONDITION_false && this.bot_cmd_condition_status & CMD_CONDITION_true_BLOCK) + else if((this.bot_cmd_condition_status & CMD_CONDITION_false) && this.bot_cmd_condition_status & CMD_CONDITION_true_BLOCK) { bot_command_executed(this, true); return -1;