Fix indentation of all the if if else I could find out and add explicit brackets...
authorterencehill <piuntn@gmail.com>
Mon, 28 Jan 2019 17:48:32 +0000 (18:48 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 28 Jan 2019 17:48:32 +0000 (18:48 +0100)
19 files changed:
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc
qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc
qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc
qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
qcsrc/common/gamemodes/gamemode/race/sv_race.qc
qcsrc/common/mapobjects/models.qc
qcsrc/common/minigames/minigame/bd.qc
qcsrc/common/minigames/minigame/ps.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/viewloc.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/server/g_world.qc

index 163b996..73bb3cf 100644 (file)
@@ -252,12 +252,13 @@ entity ca_LastPlayerForTeam(entity this)
 {
        entity last_pl = NULL;
        FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
-               if (!IS_DEAD(it))
-               if (SAME_TEAM(this, it))
-               if (!last_pl)
-                       last_pl = it;
-               else
-                       return NULL;
+               if (!IS_DEAD(it) && SAME_TEAM(this, it))
+               {
+                       if (!last_pl)
+                               last_pl = it;
+                       else
+                               return NULL;
+               }
        });
        return last_pl;
 }
index 2696a4e..5e6e97d 100644 (file)
@@ -702,10 +702,12 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
        if(flag.team)
                FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
                        if(CTF_SAMETEAM(flag, it))
-                       if(SAME_TEAM(player, it))
-                               Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
-                       else
-                               Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname);
+                       {
+                               if(SAME_TEAM(player, it))
+                                       Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
+                               else
+                                       Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname);
+                       }
                });
 
        _sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE);
index 78ff64e..50e16d5 100644 (file)
@@ -69,10 +69,12 @@ void dompoint_captured(entity this)
                this.enemy = NULL;
 
        if (head.noise != "")
+       {
                if(this.enemy)
                        _sound(this.enemy, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
                else
                        _sound(this, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
+       }
        if (head.noise1 != "")
                play2all(head.noise1);
 
@@ -466,10 +468,7 @@ MUTATOR_HOOKFUNCTION(dom, PlayerSpawn)
        entity player = M_ARGV(0, entity);
 
        if(domination_roundbased)
-       if(!round_handler_IsRoundStarted())
-               player.player_blocked = 1;
-       else
-               player.player_blocked = 0;
+               player.player_blocked = !round_handler_IsRoundStarted();
 }
 
 MUTATOR_HOOKFUNCTION(dom, ClientConnect)
index c9670a1..dc8c8b2 100644 (file)
@@ -334,14 +334,20 @@ bool Invasion_CheckWinner()
        {
                if(red_alive > 0) { winner_team = NUM_TEAM_1; }
                if(blue_alive > 0)
-               if(winner_team) { winner_team = 0; }
-               else { winner_team = NUM_TEAM_2; }
+               {
+                       if(winner_team) { winner_team = 0; }
+                       else { winner_team = NUM_TEAM_2; }
+               }
                if(yellow_alive > 0)
-               if(winner_team) { winner_team = 0; }
-               else { winner_team = NUM_TEAM_3; }
+               {
+                       if(winner_team) { winner_team = 0; }
+                       else { winner_team = NUM_TEAM_3; }
+               }
                if(pink_alive > 0)
-               if(winner_team) { winner_team = 0; }
-               else { winner_team = NUM_TEAM_4; }
+               {
+                       if(winner_team) { winner_team = 0; }
+                       else { winner_team = NUM_TEAM_4; }
+               }
        }
        else
        {
@@ -429,13 +435,15 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies)
                if(teamplay) { inv_monsters_perteam[frag_target.team] -= 1; }
 
                if(IS_PLAYER(frag_attacker))
-               if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works
-                       GameRules_scoring_add(frag_attacker, KILLS, -1);
-               else
                {
-                       GameRules_scoring_add(frag_attacker, KILLS, +1);
-                       if(teamplay)
-                               TeamScore_AddToTeam(frag_attacker.team, ST_INV_KILLS, +1);
+                       if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works
+                               GameRules_scoring_add(frag_attacker, KILLS, -1);
+                       else
+                       {
+                               GameRules_scoring_add(frag_attacker, KILLS, +1);
+                               if(teamplay)
+                                       TeamScore_AddToTeam(frag_attacker.team, ST_INV_KILLS, +1);
+                       }
                }
        }
 }
index f845673..d33696a 100644 (file)
@@ -686,10 +686,12 @@ LABEL(not_winning)
                kh_interferemsg_time = 0;
                FOREACH_CLIENT(IS_PLAYER(it), {
                        if(it.team == kh_interferemsg_team)
+                       {
                                if(it.kh_next)
                                        Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_MEET);
                                else
                                        Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_HELP);
+                       }
                        else
                                Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE));
                });
index 58582d2..e30d958 100644 (file)
@@ -225,10 +225,12 @@ void lms_RemovePlayer(entity player)
        }
 
        if (CS(player).killcount != FRAGS_SPECTATOR && player.lms_spectate_warning < 3)
+       {
                if (GameRules_scoring_add(player, LMS_RANK, 0) > 0 && player.lms_spectate_warning < 2)
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_LMS_NOLIVES, player.netname);
                else
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_LMS_FORFEIT, player.netname);
+       }
 }
 
 MUTATOR_HOOKFUNCTION(lms, ClientDisconnect)
index 854e37e..6ac6c7c 100644 (file)
@@ -679,10 +679,11 @@ void ons_ControlPoint_Touch(entity this, entity toucher)
        int attackable;
 
        if(IS_VEHICLE(toucher) && toucher.owner)
-       if(autocvar_g_onslaught_allow_vehicle_touch)
+       {
+               if (!autocvar_g_onslaught_allow_vehicle_touch)
+                       return;
                toucher = toucher.owner;
-       else
-               return;
+       }
 
        if(!IS_PLAYER(toucher)) { return; }
        if(STAT(FROZEN, toucher)) { return; }
@@ -1716,10 +1717,12 @@ MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
                for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext)
                {
                        if(SAME_TEAM(tmp_entity, player))
-                       if(random_target)
-                               RandomSelection_AddEnt(tmp_entity, 1, 1);
-                       else if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL)
-                               closest_target = tmp_entity;
+                       {
+                               if(random_target)
+                                       RandomSelection_AddEnt(tmp_entity, 1, 1);
+                               else if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL)
+                                       closest_target = tmp_entity;
+                       }
                }
 
                if(random_target) { closest_target = RandomSelection_chosen_ent; }
index 31309f2..66b23f6 100644 (file)
@@ -259,10 +259,12 @@ MUTATOR_HOOKFUNCTION(rc, MakePlayerObserver)
        entity player = M_ARGV(0, entity);
 
        if(g_race_qualifying)
-       if(GameRules_scoring_add(player, RACE_FASTEST, 0))
-               player.frags = FRAGS_LMS_LOSER;
-       else
-               player.frags = FRAGS_SPECTATOR;
+       {
+               if(GameRules_scoring_add(player, RACE_FASTEST, 0))
+                       player.frags = FRAGS_LMS_LOSER;
+               else
+                       player.frags = FRAGS_SPECTATOR;
+       }
 
        race_PreparePlayer(player);
        player.race_checkpoint = -1;
index 10c3900..44a1352 100644 (file)
@@ -166,21 +166,24 @@ bool g_clientmodel_genericsendentity(entity this, entity to, int sf)
 
 
 #define G_MODEL_INIT(ent,sol) \
-       if(ent.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
+       if(ent.geomtype && autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
        if(!ent.scale) ent.scale = ent.modelscale; \
        SetBrushEntityModel(ent); \
        ent.use = g_model_setcolormaptoactivator; \
        InitializeEntity(ent, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
-       if(!ent.solid) ent.solid = (sol); else if(ent.solid < 0) ent.solid = SOLID_NOT;
+       if(!ent.solid) ent.solid = (sol); \
+       else if(ent.solid < 0) ent.solid = SOLID_NOT;
 
 #define G_CLIENTMODEL_INIT(ent,sol) \
-       if(ent.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
+       if(ent.geomtype && autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
        if(!ent.scale) ent.scale = ent.modelscale; \
        SetBrushEntityModel(ent); \
        ent.use = g_clientmodel_use; \
        InitializeEntity(ent, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
-       if(!ent.solid) ent.solid = (sol); else if(ent.solid < 0) ent.solid = SOLID_NOT; \
-       if(!ent.bgmscriptsustain) ent.bgmscriptsustain = 1; else if(ent.bgmscriptsustain < 0) ent.bgmscriptsustain = 0; \
+       if(!ent.solid) ent.solid = (sol); \
+       else if(ent.solid < 0) ent.solid = SOLID_NOT; \
+       if(!ent.bgmscriptsustain) ent.bgmscriptsustain = 1; \
+       else if(ent.bgmscriptsustain < 0) ent.bgmscriptsustain = 0; \
        Net_LinkEntity(ent, true, 0, g_clientmodel_genericsendentity); \
        ent.default_solid = sol;
 
index 91fa9cb..8ab37af 100644 (file)
@@ -727,11 +727,13 @@ bool bd_save_level(entity minigame)
                int target_count = 0, boulder_count = 0;
                entity piece = NULL;
                while((piece = findentity(piece,owner,minigame)))
-               if(piece.classname == "minigame_board_piece")
-                       if(piece.bd_tiletype == BD_TILE_BOULDER)
-                               ++boulder_count;
-                       else if(piece.bd_tiletype == BD_TILE_TARGET)
-                               ++target_count;
+                       if(piece.classname == "minigame_board_piece")
+                       {
+                               if(piece.bd_tiletype == BD_TILE_BOULDER)
+                                       ++boulder_count;
+                               else if(piece.bd_tiletype == BD_TILE_TARGET)
+                                       ++target_count;
+                       }
 
                if(boulder_count != target_count)
                {
@@ -1162,10 +1164,12 @@ string bd_turn_to_string(int turnflags)
                return _("Better luck next time!");
 
        if ( turnflags & BD_TURN_WIN )
+       {
                if(random() > 0.5)
                        return _("Tubular! Press \"Next Level\" to continue!");
                else
                        return _("Wicked! Press \"Next Level\" to continue!");
+       }
 
        if( turnflags & BD_TURN_EDIT )
                return _("Press the space bar to change your currently selected tile");
index b5b900b..6850bd8 100644 (file)
@@ -39,15 +39,19 @@ bool ps_tile_blacklisted(string tile)
        int number = minigame_tile_number(tile);
        int letter = minigame_tile_letter(tile);
        if(letter < 2)
+       {
                if(number < 2)
                        return true;
                else if(number > PS_NUM_CNT - 3)
                        return true;
+       }
        if(letter > PS_LET_CNT - 3)
+       {
                if(number < 2)
                        return true;
                else if(number > PS_NUM_CNT - 3)
                        return true;
+       }
 
        return false;
 }
index 004fbf9..0fd6c94 100644 (file)
@@ -803,10 +803,12 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
 
                if(time > this.pain_finished && time > this.anim_finished) // TODO: use anim_finished instead!?
                if(!this.state)
-               if(vdist(this.velocity, >, 10))
-                       setanim(this, ((do_run) ? this.anim_run : this.anim_walk), true, false, false);
-               else
-                       setanim(this, this.anim_idle, true, false, false);
+               {
+                       if(vdist(this.velocity, >, 10))
+                               setanim(this, ((do_run) ? this.anim_run : this.anim_walk), true, false, false);
+                       else
+                               setanim(this, this.anim_idle, true, false, false);
+               }
        }
        else
        {
@@ -1112,10 +1114,12 @@ void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
        movelib_move_simple_gravity(this, v_forward, mspeed, 1);
 
        if(time > this.pain_finished && time > this.attack_finished_single[0])
-       if(vdist(this.velocity, >, 10))
-               setanim(this, this.anim_walk, true, false, false);
-       else
-               setanim(this, this.anim_idle, true, false, false);
+       {
+               if(vdist(this.velocity, >, 10))
+                       setanim(this, this.anim_walk, true, false, false);
+               else
+                       setanim(this, this.anim_idle, true, false, false);
+       }
 }
 
 void Monster_Anim(entity this)
index 95216fe..73c2457 100644 (file)
@@ -494,10 +494,12 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate)
 
        if(STAT(BUFFS, frag_attacker) & BUFF_BASH.m_itemid)
        if(frag_force)
-       if(frag_attacker == frag_target)
-               frag_force *= autocvar_g_buffs_bash_force_self;
-       else
-               frag_force *= autocvar_g_buffs_bash_force;
+       {
+               if(frag_attacker == frag_target)
+                       frag_force *= autocvar_g_buffs_bash_force_self;
+               else
+                       frag_force *= autocvar_g_buffs_bash_force;
+       }
 
        if(STAT(BUFFS, frag_attacker) & BUFF_DISABILITY.m_itemid)
        if(frag_target != frag_attacker)
index 37fb5f0..b3ddc61 100644 (file)
@@ -961,10 +961,11 @@ bool turret_firecheck(entity this)
        {
                // To close?
                if (this.tur_dist_aimpos < this.target_range_min)
+               {
                        if(turret_validate_target(this, this.tur_impactent, this.target_validate_flags) > 0)
                                return true; // Target of opertunity?
-                       else
-                               return false;
+                       return false;
+               }
        }
 
        // Try to avoid FF?
index be8d468..e8dd2fa 100644 (file)
@@ -643,10 +643,12 @@ void vehicles_painframe(entity this)
                        this.velocity += randomvec() * 30;
 
                if(this.vehicle_flags & VHF_DMGROLL)
+               {
                        if(this.vehicle_flags & VHF_DMGHEADROLL)
                                this.tur_head.angles += randomvec();
                        else
                                this.angles += randomvec();
+               }
        }
 }
 
@@ -730,11 +732,12 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
        if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
        {
                if(this.owner)
+               {
                        if(this.vehicle_flags & VHF_DEATHEJECT)
                                vehicles_exit(this, VHEF_EJECT);
                        else
                                vehicles_exit(this, VHEF_RELEASE);
-
+               }
 
                antilag_clear(this, this);
 
index e1be43a..55e37c4 100644 (file)
@@ -77,10 +77,12 @@ void viewloc_SetTags(entity this)
                this.viewloc = NULL;
 
        if(this.viewloc.entnum != this.tag_networkviewloc)
-       if(this.tag_networkviewloc == 0)
-               this.viewloc = NULL;
-       else
-               this.viewloc = findfloat(NULL, entnum, this.tag_networkviewloc);
+       {
+               if(this.tag_networkviewloc == 0)
+                       this.viewloc = NULL;
+               else
+                       this.viewloc = findfloat(NULL, entnum, this.tag_networkviewloc);
+       }
 }
 
 vector CursorToWorldCoord(vector mpos)
index 784276e..e1fa34c 100644 (file)
@@ -533,10 +533,12 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity)
 METHOD(Seeker, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
 {
     if(WEP_CVAR(seeker, type) == 1)
+    {
         if(W_Seeker_Tagged_Info(actor, weaponentity, actor.enemy) != NULL)
             PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
         else
             PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+    }
     else
         PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
 }
index 2e9a60a..81b34e4 100644 (file)
@@ -57,10 +57,12 @@ NET_HANDLE(TE_CSQC_VORTEXBEAMPARTICLE, bool isNew)
        particles_alphamin = particles_alphamax = particles_fade = charge;
 
        if(!MUTATOR_CALLHOOK(Particles_VortexBeam, shotorg, endpos))
-       if(autocvar_cl_particles_oldvortexbeam && (STAT(ALLOW_OLDVORTEXBEAM) || isdemo()))
-               WarpZone_TrailParticles_WithMultiplier(NULL, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), shotorg, endpos, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
-       else
-               WarpZone_TrailParticles_WithMultiplier(NULL, particleeffectnum(EFFECT_VORTEX_BEAM), shotorg, endpos, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
+       {
+               if(autocvar_cl_particles_oldvortexbeam && (STAT(ALLOW_OLDVORTEXBEAM) || isdemo()))
+                       WarpZone_TrailParticles_WithMultiplier(NULL, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), shotorg, endpos, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
+               else
+                       WarpZone_TrailParticles_WithMultiplier(NULL, particleeffectnum(EFFECT_VORTEX_BEAM), shotorg, endpos, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
+       }
        return true;
 }
 #endif
index 522f4f0..4c620c6 100644 (file)
@@ -615,10 +615,12 @@ void InitGameplayMode()
                world.fog = string_null;
        }
        if(MapInfo_Map_fog != "")
+       {
                if(MapInfo_Map_fog == "none")
                        world.fog = string_null;
                else
                        world.fog = strzone(MapInfo_Map_fog);
+       }
        clientstuff = strzone(MapInfo_Map_clientstuff);
 
        MapInfo_ClearTemps();
@@ -1644,22 +1646,29 @@ void InitiateOvertime() // ONLY call this if InitiateSuddenDeath returned true
 float GetWinningCode(float fraglimitreached, float equality)
 {
        if(autocvar_g_campaign == 1)
+       {
                if(fraglimitreached)
                        return WINNING_YES;
                else
                        return WINNING_NO;
-
+       }
        else
+       {
                if(equality)
+               {
                        if(fraglimitreached)
                                return WINNING_STARTSUDDENDEATHOVERTIME;
                        else
                                return WINNING_NEVER;
+               }
                else
+               {
                        if(fraglimitreached)
                                return WINNING_YES;
                        else
                                return WINNING_NO;
+               }
+       }
 }
 
 // set the .winning flag for exactly those players with a given field value
@@ -1729,19 +1738,20 @@ float WinningCondition_Scores(float limit, float leadlimit)
                        leaderfrags = WinningConditionHelper_topscore;
 
                        if (limit)
-                       if (leaderfrags == limit - 1)
-                               Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_1);
-                       else if (leaderfrags == limit - 2)
-                               Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_2);
-                       else if (leaderfrags == limit - 3)
-                               Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_3);
+                       {
+                               if (leaderfrags == limit - 1)
+                                       Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_1);
+                               else if (leaderfrags == limit - 2)
+                                       Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_2);
+                               else if (leaderfrags == limit - 3)
+                                       Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_REMAINING_FRAG_3);
+                       }
                }
        }
 
        limitreached = false;
-       if(limit)
-               if(WinningConditionHelper_topscore >= limit)
-                       limitreached = true;
+       if (limit && WinningConditionHelper_topscore >= limit)
+               limitreached = true;
        if(leadlimit)
        {
                float leadlimitreached;