hedgewars/uChat.pas
changeset 4465 743673c67d0c
parent 4404 6bae4e9461aa
child 4467 adedeec8f18f
equal deleted inserted replaced
4464:04b4f0c2a2fc 4465:743673c67d0c
   181 visibleCount:= cnt;
   181 visibleCount:= cnt;
   182 end;
   182 end;
   183 
   183 
   184 procedure AcceptChatString(s: shortstring);
   184 procedure AcceptChatString(s: shortstring);
   185 var i: TWave;
   185 var i: TWave;
   186 
   186     c, t: LongInt;
   187 begin
   187 begin
       
   188 t:= LocalTeam;
       
   189 if not CurrentTeam^.ExtDriven and
       
   190    ((s[1] = '"') and (s[Length(s)] = '"') or
       
   191     (s[1] = '''') and (s[Length(s)] = '''') or
       
   192     (s[1] = '-') and (s[Length(s)] = '-')) then
       
   193     for c:= 0 to Pred(TeamsCount) do
       
   194         if (TeamsArray[c] = CurrentTeam) then t:= c;
   188 // "Make hedgehog say something"
   195 // "Make hedgehog say something"
   189 if (s[1] = '"') and (s[Length(s)] = '"') then
   196 if (s[1] = '"') and (s[Length(s)] = '"') then
   190     begin
   197     begin
   191     if CurrentTeam^.ExtDriven then
   198     if t = -1 then
   192         ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
   199         ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
   193     else
   200     else
   194         ParseCommand('/hogsay '#1 + copy(s, 2, Length(s)-2), true);
   201         ParseCommand('/hogsay '#1 + char(t) + copy(s, 2, Length(s)-2), true);
   195     exit
   202     exit
   196     end;
   203     end;
   197 // 'Make hedgehog think something'
   204 // 'Make hedgehog think something'
   198 if (s[1] = '''') and (s[Length(s)] = '''') then
   205 if (s[1] = '''') and (s[Length(s)] = '''') then
   199     begin
   206     begin
   200     if CurrentTeam^.ExtDriven then
   207     if t = -1 then
   201         ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
   208         ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
   202     else
   209     else
   203         ParseCommand('/hogsay '#2 + copy(s, 2, Length(s)-2), true);
   210         ParseCommand('/hogsay '#2 + char(t) + copy(s, 2, Length(s)-2), true);
   204     exit
   211     exit
   205     end;
   212     end;
   206 // -Make hedgehog yell something-
   213 // -Make hedgehog yell something-
   207 if (s[1] = '-') and (s[Length(s)] = '-') then
   214 if (s[1] = '-') and (s[Length(s)] = '-') then
   208     begin
   215     begin
   209     if CurrentTeam^.ExtDriven then
   216     if t = -1 then
   210         ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
   217         ParseCommand('/say ' + copy(s, 2, Length(s)-2), true)
   211     else
   218     else
   212         ParseCommand('/hogsay '#3 + copy(s, 2, Length(s)-2), true);
   219         ParseCommand('/hogsay '#3 + char(t) + copy(s, 2, Length(s)-2), true);
   213     exit
   220     exit
   214     end;
   221     end;
   215 // These 3 are same as above, only are to make the hedgehog say it on next attack
   222 // These 3 are same as above, only are to make the hedgehog say it on next attack
   216 if (s[1] = '/') and (copy(s, 1, 5) = '/hsa ') then
   223 if (s[1] = '/') and (copy(s, 1, 5) = '/hsa ') then
   217     begin
   224     begin