From 61ff03e493f0cdae7d4a7b4332481f1a3971c3c7 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 30 Oct 2013 13:36:14 +0100 Subject: [PATCH 1/1] Manual riddance of remaining "if not". --- qcsrc/client/announcer.qc | 4 ++-- qcsrc/client/damage.qc | 2 +- qcsrc/client/hud.qc | 6 +++--- qcsrc/client/shownames.qc | 2 +- .../xonotic/dialog_multiplayer_playersetup_hud.c | 4 ++-- qcsrc/server/cl_impulse.qc | 2 +- qcsrc/server/command/cmd.qc | 2 +- qcsrc/server/command/sv_cmd.qc | 8 ++++---- qcsrc/server/command/vote.qc | 14 +++++++------- qcsrc/server/miscfunctions.qc | 4 ++-- qcsrc/server/scores.qc | 2 +- qcsrc/server/vehicles/bumblebee.qc | 2 +- qcsrc/server/vehicles/racer.qc | 2 +- qcsrc/server/vehicles/raptor.qc | 2 +- qcsrc/server/vehicles/spiderbot.qc | 2 +- qcsrc/server/vehicles/vehicles.qc | 2 +- qcsrc/server/w_common.qc | 5 ++++- 17 files changed, 34 insertions(+), 31 deletions(-) diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 64807b4022..24be944d28 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -106,7 +106,7 @@ void Announcer_Time() || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 300 && warmup_timeleft > 299)) { //if we're in warmup mode, check whether there's a warmup timelimit - if not(autocvar_g_warmup_limit == -1 && warmup_stage) + if(!(autocvar_g_warmup_limit == -1 && warmup_stage)) { announcer_5min = TRUE; Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_5); @@ -128,7 +128,7 @@ void Announcer_Time() || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 60)) { // if we're in warmup mode, check whether there's a warmup timelimit - if not(autocvar_g_warmup_limit == -1 && warmup_stage) + if(!(autocvar_g_warmup_limit == -1 && warmup_stage)) { announcer_1min = TRUE; Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_1); diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index a6dff72710..9f5e32e956 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -336,7 +336,7 @@ void Ent_DamageInfo(float isNew) // TODO spawn particle effects and sounds based on w_deathtype if(!DEATH_ISSPECIAL(w_deathtype)) - if not(hitplayer && !rad) // don't show ground impacts for hitscan weapons if a player was hit + if(!hitplayer || rad) // don't show ground impacts for hitscan weapons if a player was hit { float hitwep; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index fba8b7b4fb..293ad379e1 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -242,7 +242,7 @@ float GetPlayerColorForce(float i) float GetPlayerColor(float i) { - if not(playerslots[i].gotscores) // unconnected + if(!playerslots[i].gotscores) // unconnected return NUM_SPECTATOR; else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR) return NUM_SPECTATOR; @@ -1133,7 +1133,7 @@ void HUD_Powerups(void) { if(!autocvar_hud_panel_powerups) return; if(spectatee_status == -1) return; - if not(getstati(STAT_ITEMS, 0, 24) & (IT_STRENGTH | IT_INVINCIBLE | IT_SUPERWEAPON)) return; + if(!(getstati(STAT_ITEMS, 0, 24) & (IT_STRENGTH | IT_INVINCIBLE | IT_SUPERWEAPON))) return; if (getstati(STAT_HEALTH) <= 0) return; strength_time = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 99); @@ -3123,7 +3123,7 @@ void HUD_Mod_Race(vector pos, vector mySize) float f; // yet another function has this score = me.(scores[ps_primary]); - if not((scores_flags[ps_primary] & SFL_TIME) && !teamplay) // race/cts record display on HUD + if(!(scores_flags[ps_primary] & SFL_TIME) || teamplay) // race/cts record display on HUD return; // no records in the actual race // clientside personal record diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index 2ca411a1bb..a7824a9b75 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -19,7 +19,7 @@ void Draw_ShowNames(entity ent) #else if(ent.sv_entnum == player_localentnum) // ent is me or person i'm spectating #endif - if not (autocvar_hud_shownames_self && autocvar_chase_active) + if(!(autocvar_hud_shownames_self && autocvar_chase_active)) return; makevectors(view_angles); diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_hud.c b/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_hud.c index e53f99bc1f..a027c07017 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_hud.c +++ b/qcsrc/menu/xonotic/dialog_multiplayer_playersetup_hud.c @@ -15,7 +15,7 @@ void HUDSetup_Start(entity me, entity btn); #ifdef IMPLEMENTATION void HUDSetup_Check_Gamestatus(entity me, entity btn) { - if not(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)) // we're not in a match, ask the player if they want to start one anyway + if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, ask the player if they want to start one anyway { DialogOpenButton_Click(me, main.hudconfirmDialog); } @@ -100,4 +100,4 @@ void XonoticHUDDialog_fill(entity me) e.onClick = Dialog_Close; e.onClickEntity = me; } -#endif \ No newline at end of file +#endif diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index 0409390210..dc8dabee6c 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -299,7 +299,7 @@ void ImpulseCommands (void) { print("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n"); e.colormod_x = 8; - if not(e.effects & EF_NODEPTHTEST) // not already reported before + if(!(e.effects & EF_NODEPTHTEST)) // not already reported before ++m; e.effects |= EF_NODEPTHTEST | EF_RED; ++i; diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 924a38e7d7..44cc46a02b 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -279,7 +279,7 @@ void ClientCommand_selectteam(float request, float argc) if(IS_CLIENT(self)) { if(teamplay) - if not(self.team_forced > 0) + if(self.team_forced <= 0) if (!lockteams) { float selection; diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 293676eb01..7dbafa7ab8 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -93,7 +93,7 @@ void GameCommand_adminmsg(float request, float argc) client = GetFilteredEntity(t); accepted = VerifyClientEntity(client, TRUE, FALSE); - if not(accepted > 0) + if(accepted <= 0) { print("adminmsg: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n")); continue; @@ -992,7 +992,7 @@ void GameCommand_moveplayer(float request, float argc) client = GetFilteredEntity(t); accepted = VerifyClientEntity(client, FALSE, FALSE); - if not(accepted > 0) + if(accepted <= 0) { print("moveplayer: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n")); continue; @@ -1148,7 +1148,7 @@ void GameCommand_playerdemo(float request, float argc) client = GetIndexedEntity(argc, 2); accepted = VerifyClientEntity(client, FALSE, TRUE); - if not(accepted > 0) + if(accepted <= 0) { print("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".\n"); return; @@ -1164,7 +1164,7 @@ void GameCommand_playerdemo(float request, float argc) client = GetIndexedEntity(argc, 2); accepted = VerifyClientEntity(client, FALSE, FALSE); - if not(accepted > 0) + if(accepted <= 0) { print("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".\n"); return; diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 91081b0989..c444a96159 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -748,7 +748,7 @@ void VoteCommand_abstain(float request, entity caller) // CLIENT ONLY case CMD_REQUEST_COMMAND: { if (!vote_called) { print_to(caller, "^1No vote called."); } - else if not(caller.vote_selection == VOTE_SELECT_NULL || autocvar_sv_vote_change) { print_to(caller, "^1You have already voted."); } + else if(caller.vote_selection != VOTE_SELECT_NULL && !autocvar_sv_vote_change) { print_to(caller, "^1You have already voted."); } else // everything went okay, continue changing vote { @@ -786,7 +786,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm vote_command = VoteCommand_extractcommand(vote_command, 2, argc); - if not(autocvar_sv_vote_call || !caller) { print_to(caller, "^1Vote calling is not allowed."); } + if(!autocvar_sv_vote_call && caller) { print_to(caller, "^1Vote calling is not allowed."); } else if(!autocvar_sv_vote_gamestart && time < game_starttime) { print_to(caller, "^1Vote calling is not allowed before the match has started."); } else if(vote_called) { print_to(caller, "^1There is already a vote called."); } else if(!spectators_allowed && (caller && !IS_PLAYER(caller))) { print_to(caller, "^1Only players can call a vote."); } @@ -850,7 +850,7 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co if (!caller.vote_master) { print_to(caller, "^1You do not have vote master privelages."); } else if (!VoteCommand_checknasty(vote_command)) { print_to(caller, "^1Syntax error in command, see 'vhelp' for more info."); } - else if not(VoteCommand_parse(caller, vote_command, strcat(autocvar_sv_vote_commands, " ", autocvar_sv_vote_master_commands), 3, argc)) { print_to(caller, "^1This command is not acceptable, see 'vhelp' for more info."); } + else if (!VoteCommand_parse(caller, vote_command, strcat(autocvar_sv_vote_commands, " ", autocvar_sv_vote_master_commands), 3, argc)) { print_to(caller, "^1This command is not acceptable, see 'vhelp' for more info."); } else // everything went okay, proceed with command { @@ -865,9 +865,9 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co case "login": { - if not(autocvar_sv_vote_master_password != "") { print_to(caller, "^1Login to vote master is not allowed."); } + if(autocvar_sv_vote_master_password == "") { print_to(caller, "^1Login to vote master is not allowed."); } else if(caller.vote_master) { print_to(caller, "^1You are already logged in as vote master."); } - else if not(autocvar_sv_vote_master_password == argv(3)) { print_to(caller, strcat("Rejected vote master login from ", GetCallerName(caller))); } + else if(autocvar_sv_vote_master_password != argv(3)) { print_to(caller, strcat("Rejected vote master login from ", GetCallerName(caller))); } else // everything went okay, proceed with giving this player master privilages { @@ -935,7 +935,7 @@ void VoteCommand_no(float request, entity caller) // CLIENT ONLY case CMD_REQUEST_COMMAND: { if (!vote_called) { print_to(caller, "^1No vote called."); } - else if not(caller.vote_selection == VOTE_SELECT_NULL || autocvar_sv_vote_change) { print_to(caller, "^1You have already voted."); } + else if(caller.vote_selection != VOTE_SELECT_NULL && !autocvar_sv_vote_change) { print_to(caller, "^1You have already voted."); } else if(((caller == vote_caller) || caller.vote_master) && autocvar_sv_vote_no_stops_vote) { VoteStop(caller); } else // everything went okay, continue changing vote @@ -1013,7 +1013,7 @@ void VoteCommand_yes(float request, entity caller) // CLIENT ONLY case CMD_REQUEST_COMMAND: { if (!vote_called) { print_to(caller, "^1No vote called."); } - else if not(caller.vote_selection == VOTE_SELECT_NULL || autocvar_sv_vote_change) { print_to(caller, "^1You have already voted."); } + else if(caller.vote_selection != VOTE_SELECT_NULL && autocvar_sv_vote_change) { print_to(caller, "^1You have already voted."); } else // everything went okay, continue changing vote { diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 49aae079fa..c1298d0e7f 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1645,7 +1645,7 @@ void adaptor_think2use() void adaptor_think2use_hittype_splash() // for timed projectile detonation { - if not(self.flags & FL_ONGROUND) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING + if(!(self.flags & FL_ONGROUND)) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING self.projectiledeathtype |= HITTYPE_SPLASH; adaptor_think2use(); } @@ -2336,7 +2336,7 @@ void shockwave_spawn(string m, vector org, float sz, float t1, float t2) float randombit(float bits) { - if not(bits & (bits-1)) // this ONLY holds for powers of two! + if(!(bits & (bits-1))) // this ONLY holds for powers of two! return bits; float n, f, b, r; diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index aee289335d..0dc2b2f00b 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -334,7 +334,7 @@ float PlayerScore_Add(entity player, float scorefield, float score) entity s; if(gameover) - if not(g_lms && scorefield == SP_LMS_RANK) // allow writing to this field in intermission as it is needed for newly joining players + if(!(g_lms && scorefield == SP_LMS_RANK)) // allow writing to this field in intermission as it is needed for newly joining players score = 0; if(!scores_initialized) return 0; // FIXME remove this when everything uses this system diff --git a/qcsrc/server/vehicles/bumblebee.qc b/qcsrc/server/vehicles/bumblebee.qc index 4499f26ae5..a0a7e5ffc6 100644 --- a/qcsrc/server/vehicles/bumblebee.qc +++ b/qcsrc/server/vehicles/bumblebee.qc @@ -913,7 +913,7 @@ void spawnfunc_vehicle_bumblebee() if(autocvar_g_vehicle_bumblebee_health_regen) self.vehicle_flags |= VHF_HEALTHREGEN; - if not(vehicle_initialize( + if(!vehicle_initialize( "Bumblebee", "models/vehicles/bumblebee_body.dpm", "", "models/vehicles/spiderbot_cockpit.dpm", "", "", "tag_viewport", HUD_BUMBLEBEE, BUMB_MIN, BUMB_MAX, FALSE, diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index bbcf11c074..c4f7b436c8 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -666,7 +666,7 @@ void spawnfunc_vehicle_racer() if(autocvar_g_vehicle_racer_health_regen) self.vehicle_flags |= VHF_HEALTHREGEN; - if not (vehicle_initialize( + if(!vehicle_initialize( "Wakizashi", "models/vehicles/wakizashi.dpm", "null", // we need this so tur_head is networked and usable for sounds diff --git a/qcsrc/server/vehicles/raptor.qc b/qcsrc/server/vehicles/raptor.qc index 2472f3a0de..229bbfedac 100644 --- a/qcsrc/server/vehicles/raptor.qc +++ b/qcsrc/server/vehicles/raptor.qc @@ -914,7 +914,7 @@ void spawnfunc_vehicle_raptor() precache_sound ("vehicles/raptor_speed.wav"); precache_sound ("vehicles/missile_alarm.wav"); - if not (vehicle_initialize( + if(!vehicle_initialize( "Raptor", "models/vehicles/raptor.dpm", "", diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index 478067c8e7..9b37d3e6fd 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -855,7 +855,7 @@ void spawnfunc_vehicle_spiderbot() if(autocvar_g_vehicle_spiderbot_health_regen) self.vehicle_flags |= VHF_HEALTHREGEN; - if not (vehicle_initialize( + if(!vehicle_initialize( "Spiderbot", "models/vehicles/spiderbot.dpm", "models/vehicles/spiderbot_top.dpm", diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc index f9aa1a04c9..f1fca41eb1 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicles.qc @@ -275,7 +275,7 @@ void vehicles_locktarget(float incr, float decr, float _lock_time) if(trace_ent.deadflag != DEAD_NO) trace_ent = world; - if not (trace_ent.vehicle_flags & VHF_ISVEHICLE || + if(!trace_ent.vehicle_flags & VHF_ISVEHICLE || trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET || trace_ent.takedamage == DAMAGE_TARGETDRONE) trace_ent = world; diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index b9c37cc4d5..dd89ec2f88 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -104,7 +104,10 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f // Find all non-hit players the beam passed close by if(deathtype == WEP_MINSTANEX || deathtype == WEP_NEX) { - FOR_EACH_REALCLIENT(msg_entity) if(msg_entity != self) if(!msg_entity.railgunhit) if not(IS_SPEC(msg_entity) && msg_entity.enemy == self) // we use realclient, so spectators can hear the whoosh too + FOR_EACH_REALCLIENT(msg_entity) + if(msg_entity != self) + if(!msg_entity.railgunhit) + if(!(IS_SPEC(msg_entity) && msg_entity.enemy == self)) // we use realclient, so spectators can hear the whoosh too { // nearest point on the beam beampos = start + dir * bound(0, (msg_entity.origin - start) * dir, length); -- 2.39.2