summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c0e17a)
raw | patch | inline | side by side (parent: 3c0e17a)
author | Dmitry D. Chernov <blackdoomer@yandex.ru> | |
Sat, 15 Jul 2023 10:46:45 +0000 (20:46 +1000) | ||
committer | Dmitry D. Chernov <blackdoomer@yandex.ru> | |
Sat, 15 Jul 2023 10:46:45 +0000 (20:46 +1000) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 4fbede48721b20714b43ca74026b6d2683a21efc..71eb6095d6ee5ef232245707315b9c1e2e347798 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
else if (cmd = 'addbot') or
(cmd = 'bot_add') then
begin
- if Length(P) > 2 then
- g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2), StrToIntDef(P[2], 100))
- else if Length(P) > 1 then
- g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2))
+ case Length(P) of
+ 1: g_Bot_Add(TEAM_NONE, 2);
+ 2: g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2));
else
- g_Bot_Add(TEAM_NONE, 2);
+ g_Bot_Add(TEAM_NONE, StrToIntDef(P[1], 2), StrToIntDef(P[2], 100));
+ end;
end
else if cmd = 'bot_addlist' then
begin
- if Length(P) > 1 then
- begin
- if Length(P) = 2 then
- g_Bot_AddList(TEAM_NONE, P[1], StrToIntDef(P[1], -1))
- else
- begin
- if P[2] = 'red' then
- t := TEAM_RED
- else if P[2] = 'blue' then
- t := TEAM_BLUE
- else
- t := TEAM_NONE;
-
- if Length(P) = 3
- then g_Bot_AddList(t, P[1], StrToIntDef(P[1], -1))
- else g_Bot_AddList(t, P[1], StrToIntDef(P[1], -1), StrToIntDef(P[3], 100));
- end;
+ case Length(P) of
+ 1: g_Bot_AddList(TEAM_NONE, '');
+ 2: g_Bot_AddList(TEAM_NONE, P[1], StrToIntDef(P[1], -1));
+ else
+ if P[2] = 'red' then
+ t := TEAM_RED
+ else if P[2] = 'blue' then
+ t := TEAM_BLUE
+ else
+ t := TEAM_NONE;
+
+ if Length(P) = 3
+ then g_Bot_AddList(t, P[1], StrToIntDef(P[1], -1))
+ else g_Bot_AddList(t, P[1], StrToIntDef(P[1], -1), StrToIntDef(P[3], 100));
end;
end
else if cmd = 'bot_removeall' then
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 06176d94272587199f1e6c7f910cb046fc5565f4..cda360c1006e6ad066964625442ae568e12fac86 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
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;