changeset 4374 | bcefeeabaa33 |
parent 4373 | fe0e3903bb9e |
child 4376 | 9654205a9424 |
4373:fe0e3903bb9e | 4374:bcefeeabaa33 |
---|---|
40 procedure InitIPC; |
40 procedure InitIPC; |
41 procedure CloseIPC; |
41 procedure CloseIPC; |
42 procedure NetGetNextCmd; |
42 procedure NetGetNextCmd; |
43 |
43 |
44 implementation |
44 implementation |
45 uses uConsole, uConsts, uMisc, uLand, uChat, uTeams, uTypes, uVariables, uCommands; |
45 uses uConsole, uConsts, uMisc, uLand, uChat, uTeams, uTypes, uVariables, uCommands, uUtils; |
46 |
46 |
47 type PCmd = ^TCmd; |
47 type PCmd = ^TCmd; |
48 TCmd = packed record |
48 TCmd = packed record |
49 Next: PCmd; |
49 Next: PCmd; |
50 loTime: Word; |
50 loTime: Word; |
136 'S': GameType:= gmtSave; |
136 'S': GameType:= gmtSave; |
137 else OutError(errmsgIncorrectUse + ' IPC "T" :' + s[2], true) end; |
137 else OutError(errmsgIncorrectUse + ' IPC "T" :' + s[2], true) end; |
138 else |
138 else |
139 loTicks:= SDLNet_Read16(@s[byte(s[0]) - 1]); |
139 loTicks:= SDLNet_Read16(@s[byte(s[0]) - 1]); |
140 AddCmd(loTicks, s); |
140 AddCmd(loTicks, s); |
141 {$IFDEF DEBUGFILE}AddFileLog('IPC in: '+s[1]+' ticks '+inttostr(lastcmd^.loTime));{$ENDIF} |
141 {$IFDEF DEBUGFILE}AddFileLog('IPC in: '+s[1]+' ticks '+IntToStr(lastcmd^.loTime));{$ENDIF} |
142 end |
142 end |
143 end; |
143 end; |
144 |
144 |
145 procedure IPCCheckSock; |
145 procedure IPCCheckSock; |
146 const ss: shortstring = ''; |
146 const ss: shortstring = ''; |
309 WriteLnToConsole(s) |
309 WriteLnToConsole(s) |
310 end; |
310 end; |
311 'F': TeamGone(copy(headcmd^.str, 2, Pred(headcmd^.len))); |
311 'F': TeamGone(copy(headcmd^.str, 2, Pred(headcmd^.len))); |
312 'N': begin |
312 'N': begin |
313 tmpflag:= false; |
313 tmpflag:= false; |
314 {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(hiTicks shl 16 + headcmd^.loTime)){$ENDIF} |
314 {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime)){$ENDIF} |
315 end; |
315 end; |
316 'p': begin |
316 'p': begin |
317 x16:= SDLNet_Read16(@(headcmd^.X)); |
317 x16:= SDLNet_Read16(@(headcmd^.X)); |
318 y16:= SDLNet_Read16(@(headcmd^.Y)); |
318 y16:= SDLNet_Read16(@(headcmd^.Y)); |
319 doPut(x16, y16, false) |
319 doPut(x16, y16, false) |
340 end; |
340 end; |
341 |
341 |
342 if (headcmd <> nil) and tmpflag and (not CurrentTeam^.hasGone) then |
342 if (headcmd <> nil) and tmpflag and (not CurrentTeam^.hasGone) then |
343 TryDo(GameTicks < hiTicks shl 16 + headcmd^.loTime, |
343 TryDo(GameTicks < hiTicks shl 16 + headcmd^.loTime, |
344 'oops, queue error. in buffer: ' + headcmd^.cmd + |
344 'oops, queue error. in buffer: ' + headcmd^.cmd + |
345 ' (' + inttostr(GameTicks) + ' > ' + |
345 ' (' + IntToStr(GameTicks) + ' > ' + |
346 inttostr(hiTicks shl 16 + headcmd^.loTime) + ')', |
346 IntToStr(hiTicks shl 16 + headcmd^.loTime) + ')', |
347 true); |
347 true); |
348 |
348 |
349 isInLag:= (headcmd = nil) and tmpflag and (not CurrentTeam^.hasGone); |
349 isInLag:= (headcmd = nil) and tmpflag and (not CurrentTeam^.hasGone); |
350 |
350 |
351 if isInLag then fastUntilLag:= false |
351 if isInLag then fastUntilLag:= false |