# HG changeset patch # User nemo # Date 1243396327 0 # Node ID d39c61eaca15654d4f10135fd0cad70a1e15f4ae # Parent c49832b4bb38e1af13a25fa276253b9bb01ccc2c experiment in only sending a message to your clan diff -r c49832b4bb38 -r d39c61eaca15 hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Wed May 27 03:48:59 2009 +0000 +++ b/hedgewars/CCHandlers.inc Wed May 27 03:52:07 2009 +0000 @@ -332,6 +332,17 @@ AddChatString(s) end; +procedure chTeamSay(var s: shortstring); +var text: shortstring; +begin +SendIPC('b' + s); + +text:= copy(s, 2, Length(s)-1); +text:= UserNick + ': ' + text; + +AddChatString(text) +end; + procedure chTimer(var s: shortstring); begin if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or (CurrentTeam = nil) then exit; diff -r c49832b4bb38 -r d39c61eaca15 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Wed May 27 03:48:59 2009 +0000 +++ b/hedgewars/uChat.pas Wed May 27 03:52:07 2009 +0000 @@ -131,6 +131,7 @@ procedure AcceptChatString(s: shortstring); var i: TWave; + begin // "Make hedgehog say something" if (s[1] = '"') and (s[Length(s)] = '"') then @@ -185,6 +186,12 @@ exit end; +if copy(s, 1, 4) = '/ts ' then + begin + AddFileLog('attempting teamsay: '+s); + ParseCommand('/teamsay ' + char(LocalClan) + copy(s, 5, Length(s)-4), true); + exit + end; if (s[1] = '/') and (copy(s, 1, 4) <> '/me ') then begin if CurrentTeam^.ExtDriven then exit; diff -r c49832b4bb38 -r d39c61eaca15 hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Wed May 27 03:48:59 2009 +0000 +++ b/hedgewars/uConsole.pas Wed May 27 03:52:07 2009 +0000 @@ -264,6 +264,7 @@ RegisterVariable('newgrave', vtCommand, @chNewGrave , false); RegisterVariable('say' , vtCommand, @chSay , true ); RegisterVariable('hogsay' , vtCommand, @chHogSay , true ); +RegisterVariable('teamsay' , vtCommand, @chTeamSay , true ); RegisterVariable('ammomenu', vtCommand, @chAmmoMenu , false); RegisterVariable('+precise', vtCommand, @chPrecise_p , false); RegisterVariable('-precise', vtCommand, @chPrecise_m , false); diff -r c49832b4bb38 -r d39c61eaca15 hedgewars/uIO.pas --- a/hedgewars/uIO.pas Wed May 27 03:48:59 2009 +0000 +++ b/hedgewars/uIO.pas Wed May 27 03:52:07 2009 +0000 @@ -252,6 +252,7 @@ and tmpflag and ((GameTicks = headcmd^.Time) or (headcmd^.cmd = 's') + or (headcmd^.cmd = 'b') or (headcmd^.cmd = 'F')) do begin case headcmd^.cmd of @@ -295,6 +296,12 @@ 't': ParseCommand('taunt ' + headcmd^.str[2], true); 'g': ParseCommand('newgrave', true); 'h': ParseCommand('hogsay ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true); + 'b': if LocalClan = byte(headcmd^.str[2]) then + begin + s:= copy(headcmd^.str, 3, Pred(headcmd^.len)); + AddChatString(s); + WriteLnToConsole(s) + end; '1'..'5': ParseCommand('timer ' + headcmd^.cmd, true); #128..char(128 + cMaxSlotIndex): ParseCommand('slot ' + char(byte(headcmd^.cmd) - 79), true) else diff -r c49832b4bb38 -r d39c61eaca15 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Wed May 27 03:48:59 2009 +0000 +++ b/hedgewars/uTeams.pas Wed May 27 03:52:07 2009 +0000 @@ -93,6 +93,7 @@ TeamsCount: Longword = 0; ClansArray: array[0..Pred(cMaxTeams)] of PClan; ClansCount: Longword = 0; + LocalClan: Longword = 0; // first non-bot, non-extdriven clan CurMinAngle, CurMaxAngle: Longword; function AddTeam(TeamColor: Longword): PTeam; @@ -307,6 +308,8 @@ for t:= 0 to Pred(TeamsCount) do with TeamsArray[t]^ do begin + if (not ExtDriven) and (Hedgehogs[0].BotLevel = 0) then + LocalClan:= Clan^.ClanIndex + 1; th:= 0; for i:= 0 to cMaxHHIndex do if Hedgehogs[i].Gear <> nil then