DEADSOFTWARE

fix freeze when running out of bot names
authorfgsfds <pvt.fgsfds@gmail.com>
Mon, 17 Feb 2020 16:07:25 +0000 (19:07 +0300)
committerfgsfds <pvt.fgsfds@gmail.com>
Mon, 17 Feb 2020 16:07:25 +0000 (19:07 +0300)
src/game/g_player.pas

index 2f089d711a6bd6265a1a6284c36c4f12b04c7ce1..94ca02efbd7372227be18b606ad975f94c2f0673 100644 (file)
@@ -1072,12 +1072,6 @@ begin
         Break;
       end;
 
-// Èìåíè íåò, çàäàåì ñëó÷àéíîå:
-  if _name = '' then
-    repeat
-      _name := Format('DFBOT%.2d', [Random(100)]);
-    until g_Player_ValidName(_name);
-
 // Âûáèðàåì ñëó÷àéíóþ ìîäåëü:
   _model := m[Random(Length(m))];
 
@@ -1088,7 +1082,11 @@ begin
                                          Min(Random(9)*32, 255)),
                                     Team, True)) as TBot do
   begin
-    Name := _name;
+  // Åñëè èìåíè íåò, äåëàåì åãî èç UID áîòà
+    if _name = '' then
+      Name := Format('DFBOT%.5d', [UID])
+    else
+      Name := _name;
 
     case Difficult of
       1: FDifficult := DIFFICULT_EASY;