From 48b4e4111d5f86af9a0f968f5ef7cf76b3ce538b Mon Sep 17 00:00:00 2001 From: "Dmitry D. Chernov" Date: Sat, 15 Jul 2023 21:22:01 +1000 Subject: [PATCH] Allow not to specify a name in the bot preset to choose it from the general list --- src/game/g_player.pas | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 82ce130..0990c0e 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -1116,6 +1116,13 @@ begin // Èìÿ áîòà: _name := BotList[num].name; + if (_name = '') and (BotNames <> nil) then + for a := 0 to High(BotNames) do + if g_Player_ExistingName(BotNames[a]) then + begin + _name := BotNames[a]; + Break; + end; // Ìîäåëü: _model := BotList[num].model; @@ -1126,7 +1133,10 @@ begin // Ñîçäàåì áîòà: with g_Player_Get(g_Player_Create(_model, BotList[num].color, Team, True)) as TBot do begin - Name := _name; + // Åñëè èìåíè íåò, äåëàåì åãî èç UID áîòà + if _name = '' + then Name := Format('DFBOT%.5d', [UID]) + else Name := _name; FDifficult.DiagFire := BotList[num].diag_fire; FDifficult.InvisFire := BotList[num].invis_fire; -- 2.29.2