]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
numbered bots FIX
authorterencehill <piuntn@gmail.com>
Thu, 17 Jun 2010 18:34:50 +0000 (20:34 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 17 Jun 2010 18:34:50 +0000 (20:34 +0200)
- 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

index 940782c8239d9538f474405d87d7b21f967dc447..3ef50481dc5eb785e6cf2d60a0d26c47078b9436 100644 (file)
@@ -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
 };