From 41da18dcc3d29e00c9cf6c7c38edba84bd90a4ba Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 20 Mar 2019 19:35:59 +0100 Subject: [PATCH] Simplify bot_forced_team checks, set bot_forced_team to 0 if it isn't valid --- qcsrc/server/bot/default/bot.qc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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); } -- 2.39.2