Ignore message-type chat commands (/hsa, /clan, etc.) w/ empty arg list
authorWuzzy <Wuzzy2@mail.ru>
Thu, 04 Oct 2018 17:46:01 +0200
changeset 13853 d1f7a8a11526
parent 13852 266a25b79374
child 13854 b07610de9957
Ignore message-type chat commands (/hsa, /clan, etc.) w/ empty arg list
hedgewars/uChat.pas
--- a/hedgewars/uChat.pas	Thu Oct 04 17:30:24 2018 +0200
+++ b/hedgewars/uChat.pas	Thu Oct 04 17:46:01 2018 +0200
@@ -437,12 +437,15 @@
 
 t:= LocalTeam;
 x:= 0;
+// speech bubble
 if (s[1] = '"') and (s[Length(s)] = '"')
     then x:= 1
 
+// thinking bubble
 else if (s[1] = '''') and (s[Length(s)] = '''') then
     x:= 2
 
+// yelling bubble
 else if (s[1] = '-') and (s[Length(s)] = '-') then
     x:= 3;
 
@@ -462,7 +465,16 @@
 
 if (s[1] = '/') then
     begin
-    // These 3 are same as above, only are to make the hedgehog say it on next attack
+
+    // Ignore message-type commands with empty argument list
+    if (copy(s, 2, 2) = 'me') and (Length(s) = 3) then
+        exit;
+    if ((copy(s, 2, 3) = 'hsa') or (copy(s, 2, 3) = 'hta') or (copy(s, 2, 3) = 'hya')) and (Length(s) = 4) then
+        exit;
+    if ((copy(s, 2, 4) = 'team') or (copy(s, 2, 4) = 'clan')) and (Length(s) = 5) then
+        exit;
+
+    // Speech bubble, but on next attack
     if (copy(s, 2, 4) = 'hsa ') then
         begin
         if CurrentTeam^.ExtDriven then
@@ -472,6 +484,7 @@
         exit
         end;
 
+    // Thinking bubble, but on next attack
     if (copy(s, 2, 4) = 'hta ') then
         begin
         if CurrentTeam^.ExtDriven then
@@ -481,6 +494,7 @@
         exit
         end;
 
+    // Yelling bubble, but on next attack
     if (copy(s, 2, 4) = 'hya ') then
         begin
         if CurrentTeam^.ExtDriven then