From 091db94fed51362320e122b4e1745626c4f929d7 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 17 Jun 2010 20:34:50 +0200 Subject: [PATCH] numbered bots FIX - Bots were created already numbered (1) when the previous map ended cause of expired time. - In the algorithm that determines the priority of bot name creation, check the field 'cleanname' instead of 'prefix + name + suffix', as the latter changes when the bot name gets numbered. --- (Sorry, I meant include this (old) fix too in the previous commit, but I didn't realize I didn't...) --- qcsrc/server/bot/bot.qc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index 940782c82..3ef50481d 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -136,7 +136,8 @@ void bot_setnameandstuff() prio = 1; FOR_EACH_CLIENT(p) { - if(strcat(prefix, s, suffix) == p.netname) + if(clienttype(p) == CLIENTTYPE_BOT) + if(s == p.cleanname) { prio = 0; break; @@ -200,8 +201,6 @@ void bot_setnameandstuff() else name = bot_name; - self.cleanname = strzone(name); - // number bots with identical names float i; i = 0; @@ -212,7 +211,11 @@ void bot_setnameandstuff() ++i; } if (i) - name = strcat(name, "(", ftos(i), ")"); + self.netname = self.netname_freeme = strzone(strcat(prefix, name, "(", ftos(i), ")", suffix)); + else + self.netname = self.netname_freeme = strzone(strcat(prefix, name, suffix)); + + self.cleanname = strzone(name); // pick the model and skin if(substring(bot_model, -4, 1) != ".") @@ -220,8 +223,6 @@ void bot_setnameandstuff() self.playermodel = self.playermodel_freeme = strzone(strcat("models/player/", bot_model)); self.playerskin = self.playerskin_freeme = strzone(bot_skin); - self.netname = self.netname_freeme = strzone(strcat(prefix, name, suffix)); - self.cvar_cl_accuracy_data_share = 1; // share the bots weapon accuracy data with the world self.cvar_cl_accuracy_data_receive = 0; // don't receive any weapon accuracy data }; -- 2.39.2