DEADSOFTWARE

Select bot preset randomly if no arguments are given to the 'bot_addlist' console...
[d2df-sdl.git] / src / game / g_player.pas
index 06176d94272587199f1e6c7f910cb046fc5565f4..cda360c1006e6ad066964625442ae568e12fac86 100644 (file)
@@ -1096,18 +1096,23 @@ begin
         Team := BotList[num].team; // CTF / TDM
 
 // Âûáèðàåì íàñòðîéêè áîòà èç ñïèñêà ïî íîìåðó èëè èìåíè:
-  lName := AnsiLowerCase(lName);
-  if (num < 0) or (num > Length(BotList)-1) then
-    num := -1;
-  if (num = -1) and (lName <> '') and (BotList <> nil) then
-    for a := 0 to High(BotList) do
-      if AnsiLowerCase(BotList[a].name) = lName then
-      begin
-        num := a;
-        Break;
-      end;
-  if num = -1 then
-    Exit;
+  if lName = '' then 
+    num := Random(Length(BotList))
+  else
+  begin
+    if (num < 0) or (num > Length(BotList)-1) then
+      num := -1;
+    if (num = -1) and (BotList <> nil) then
+      lName := AnsiLowerCase(lName);
+      for a := 0 to High(BotList) do
+        if AnsiLowerCase(BotList[a].name) = lName then
+        begin
+          num := a;
+          Break;
+        end;
+    if num = -1 then
+      Exit;
+  end;
 
 // Èìÿ áîòà:
   _name := BotList[num].name;