From: fgsfds Date: Mon, 17 Feb 2020 16:07:25 +0000 (+0300) Subject: fix freeze when running out of bot names X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=3056df542f2b65030778a518aaf7b1b852b3df73;p=d2df-sdl.git fix freeze when running out of bot names --- diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 2f089d7..94ca02e 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -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;