hedgewars/uIO.pas
changeset 1351 aa7aefec5c1b
parent 1066 1f1b3686a2b0
child 1352 405ad07cf875
equal deleted inserted replaced
1350:99a921e292f4 1351:aa7aefec5c1b
    35 procedure NetGetNextCmd;
    35 procedure NetGetNextCmd;
    36 
    36 
    37 var hiTicks: Word = 0;
    37 var hiTicks: Word = 0;
    38 
    38 
    39 implementation
    39 implementation
    40 uses uConsole, uConsts, uWorld, uMisc, uLand, uChat;
    40 uses uConsole, uConsts, uWorld, uMisc, uLand, uChat, uTeams;
    41 const isPonged: boolean = false;
    41 const isPonged: boolean = false;
    42 
    42 
    43 type PCmd = ^TCmd;
    43 type PCmd = ^TCmd;
    44      TCmd = packed record
    44      TCmd = packed record
    45             Next: PCmd;
    45             Next: PCmd;
    62 begin
    62 begin
    63 new(Result);
    63 new(Result);
    64 FillChar(Result^, sizeof(TCmd), 0);
    64 FillChar(Result^, sizeof(TCmd), 0);
    65 Result^.Time:= Time;
    65 Result^.Time:= Time;
    66 Result^.str:= str;
    66 Result^.str:= str;
    67 dec(Result^.len, 2); // cut timestamp
    67 if Result^.cmd <> 'F' then dec(Result^.len, 2); // cut timestamp
    68 if headcmd = nil then
    68 if headcmd = nil then
    69    begin
    69    begin
    70    headcmd:= Result;
    70    headcmd:= Result;
    71    lastcmd:= Result
    71    lastcmd:= Result
    72    end else
    72    end else
   214 var tmpflag: boolean;
   214 var tmpflag: boolean;
   215 	s: shortstring;
   215 	s: shortstring;
   216 begin
   216 begin
   217 tmpflag:= true;
   217 tmpflag:= true;
   218 
   218 
   219 while (headcmd <> nil) and ((GameTicks = headcmd^.Time) or (headcmd^.cmd = 's')) do
   219 while (headcmd <> nil)
       
   220 	and ((GameTicks = headcmd^.Time)
       
   221 		or (headcmd^.cmd = 's')
       
   222 		or (headcmd^.cmd = 'F')) do
   220 	begin
   223 	begin
   221 	case headcmd^.cmd of
   224 	case headcmd^.cmd of
   222 		'+': ; // do nothing - it's just empty packet
   225 		'+': ; // do nothing - it's just empty packet
   223 		'L': ParseCommand('+left', true);
   226 		'L': ParseCommand('+left', true);
   224 		'l': ParseCommand('-left', true);
   227 		'l': ParseCommand('-left', true);
   237 		's': begin
   240 		's': begin
   238 			s:= copy(headcmd^.str, 2, Pred(headcmd^.len));
   241 			s:= copy(headcmd^.str, 2, Pred(headcmd^.len));
   239 			AddChatString(s);
   242 			AddChatString(s);
   240 			WriteLnToConsole(s)
   243 			WriteLnToConsole(s)
   241 			end;
   244 			end;
       
   245 		'F': TeamGone(copy(headcmd^.str, 2, Pred(headcmd^.len)));
   242 		'N': begin
   246 		'N': begin
   243 			tmpflag:= false;
   247 			tmpflag:= false;
   244 			{$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(headcmd^.Time)){$ENDIF}
   248 			{$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(headcmd^.Time)){$ENDIF}
   245 			end;
   249 			end;
   246 		'p': begin
   250 		'p': begin