]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Simplify bot_forced_team checks, set bot_forced_team to 0 if it isn't valid
authorterencehill <piuntn@gmail.com>
Wed, 20 Mar 2019 18:35:59 +0000 (19:35 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 20 Mar 2019 18:35:59 +0000 (19:35 +0100)
qcsrc/server/bot/default/bot.qc

index 3911d596dc51859afd8058272ec394bf402014a7..5d34484912b868ad775a83d140b439570522021a 100644 (file)
@@ -427,16 +427,15 @@ void bot_clientconnect(entity this)
                bot_setclientfields(this);
        }
 
-       if(this.bot_forced_team==1)
-               this.team = NUM_TEAM_1;
-       else if(this.bot_forced_team==2)
-               this.team = NUM_TEAM_2;
-       else if(this.bot_forced_team==3)
-               this.team = NUM_TEAM_3;
-       else if(this.bot_forced_team==4)
-               this.team = NUM_TEAM_4;
+       if (Team_IsValidIndex(this.bot_forced_team))
+       {
+               this.team = Team_IndexToTeam(this.bot_forced_team);
+       }
        else
+       {
+               this.bot_forced_team = 0;
                TeamBalance_JoinBestTeam(this);
+       }
 
        havocbot_setupbot(this);
 }