From: terencehill Date: Tue, 29 May 2018 18:38:06 +0000 (+0200) Subject: Bot AI: fix initial CTF role assignment when a bot is added to the server X-Git-Tag: xonotic-v0.8.5~1923^2~44 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=00581af75764d15b2f77109002aa7b07554d7859;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: fix initial CTF role assignment when a bot is added to the server --- diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index cb78fe384..6468bacb8 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -1576,7 +1576,6 @@ void havocbot_ctf_reset_role(entity this) { float cdefense, cmiddle, coffense; entity mf, ef; - float c; if(IS_DEAD(this)) return; @@ -1605,11 +1604,12 @@ void havocbot_ctf_reset_role(entity this) return; } - // if there is only me on the team switch to offense - c = 0; - FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), { ++c; }); + // if there is no one else on the team switch to offense + int count = 0; + // don't check if this bot is a player since it isn't true when the bot is added to the server + FOREACH_CLIENT(it != this && IS_PLAYER(it) && SAME_TEAM(it, this), { ++count; }); - if(c==1) + if (count == 0) { havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_OFFENSE); return;