]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Assign entity number as name to bots without name (when bot_config_file is "")
authorterencehill <piuntn@gmail.com>
Fri, 29 Jun 2018 10:03:06 +0000 (12:03 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 29 Jun 2018 10:03:06 +0000 (12:03 +0200)
qcsrc/server/bot/default/bot.qc

index 2c5627bf63daa7311af2cdcf3e6bd84c7680787c..08d16a71f091dcf626eeae7ae918cb825c8da8e6 100644 (file)
@@ -249,16 +249,23 @@ void bot_setnameandstuff(entity this)
                name = bot_name;
 
        // number bots with identical names
-       int j = 0;
-       FOREACH_CLIENT(IS_BOT_CLIENT(it), {
-               if(it.cleanname == name)
-                       ++j;
-       });
-       if (j)
-               this.netname = this.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix));
-       else
+       if (name == "")
+       {
+               name = ftos(etof(this));
                this.netname = this.netname_freeme = strzone(strcat(prefix, name, suffix));
-
+       }
+       else
+       {
+               int j = 0;
+               FOREACH_CLIENT(IS_BOT_CLIENT(it), {
+                       if(it.cleanname == name)
+                               ++j;
+               });
+               if (j)
+                       this.netname = this.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix));
+               else
+                       this.netname = this.netname_freeme = strzone(strcat(prefix, name, suffix));
+       }
        this.cleanname = strzone(name);
 
        // pick the model and skin