From: terencehill Date: Thu, 2 Nov 2017 17:10:08 +0000 (+0100) Subject: Don't assign needlessly a frame to find a new goal to dead or frozen bots as they... X-Git-Tag: xonotic-v0.8.5~2378^2~30 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2b3e29cb0a6faadcb0f087589c5305addc9cde9e;p=xonotic%2Fxonotic-data.pk3dir.git Don't assign needlessly a frame to find a new goal to dead or frozen bots as they won't make use of it anyway, making the other bots a bit more responsive --- diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 0b591915d..61a69747c 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -771,10 +771,22 @@ void bot_serverframe() if (bot_strategytoken_taken) { bot_strategytoken_taken = false; - if (bot_strategytoken) - bot_strategytoken = bot_strategytoken.nextbot; - if (!bot_strategytoken) - bot_strategytoken = bot_list; + entity bot_strategytoken_save = bot_strategytoken; + while (true) + { + if (bot_strategytoken) + bot_strategytoken = bot_strategytoken.nextbot; + if (!bot_strategytoken) + bot_strategytoken = bot_list; + + if (!(IS_DEAD(bot_strategytoken) || STAT(FROZEN, bot_strategytoken))) + break; + + if (!bot_strategytoken_save) // break loop if all the bots are dead or frozen + break; + if (bot_strategytoken == bot_strategytoken_save) + bot_strategytoken_save = NULL; // looped through all the bots + } } if (botframe_nextdangertime < time) diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index cf4136c6e..98f8b790b 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -33,8 +33,7 @@ void havocbot_ai(entity this) if(bot_execute_commands(this)) return; - if (bot_strategytoken == this) - if (!bot_strategytoken_taken) + if (bot_strategytoken == this && !bot_strategytoken_taken) { if(this.havocbot_blockhead) {