From: terencehill Date: Wed, 20 Mar 2019 18:35:59 +0000 (+0100) Subject: Simplify bot_forced_team checks, set bot_forced_team to 0 if it isn't valid X-Git-Tag: xonotic-v0.8.5~1574 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=41da18dcc3d29e00c9cf6c7c38edba84bd90a4ba;p=xonotic%2Fxonotic-data.pk3dir.git Simplify bot_forced_team checks, set bot_forced_team to 0 if it isn't valid --- diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 3911d596d..5d3448491 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -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); }