From 2b3e29cb0a6faadcb0f087589c5305addc9cde9e Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 2 Nov 2017 18:10:08 +0100 Subject: [PATCH] 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 --- qcsrc/server/bot/default/bot.qc | 20 +++++++++++++++---- qcsrc/server/bot/default/havocbot/havocbot.qc | 3 +-- 2 files changed, 17 insertions(+), 6 deletions(-) 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) { -- 2.39.2