Fix taunt commands triggering 'unknown chat command' warning if current hog is external or bot
authorWuzzy <Wuzzy2@mail.ru>
Fri, 05 Jun 2020 00:57:05 +0200
changeset 15592 46b7b2c821d0
parent 15591 130b5052335c
child 15593 f0ac916a0608
Fix taunt commands triggering 'unknown chat command' warning if current hog is external or bot
hedgewars/uChat.pas
--- a/hedgewars/uChat.pas	Fri Jun 05 00:37:33 2020 +0200
+++ b/hedgewars/uChat.pas	Fri Jun 05 00:57:05 2020 +0200
@@ -635,15 +635,14 @@
         end;
 
     // hedghog animations/taunts and engine commands
-    if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then
-        begin
-        for i:= Low(TWave) to High(TWave) do
-            if (s = Wavez[i].cmd) then
-                begin
+    for i:= Low(TWave) to High(TWave) do
+        if (s = Wavez[i].cmd) then
+            begin
+            // only works for local non-bot teams
+            if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then
                 ParseCommand('/taunt ' + char(i), true);
-                exit
-                end;
-        end;
+            exit;
+            end;
 
     for j:= Low(TChatCmd) to High(TChatCmd) do
         if (s = ChatCommandz[j].ChatCmd) then