equal
deleted
inserted
replaced
25 procedure initModule; |
25 procedure initModule; |
26 procedure freeModule; |
26 procedure freeModule; |
27 |
27 |
28 procedure InitIPC; |
28 procedure InitIPC; |
29 procedure SendIPC(s: shortstring); |
29 procedure SendIPC(s: shortstring); |
30 procedure SendIPCc(c: char); |
|
31 procedure SendIPCXY(cmd: char; X, Y: SmallInt); |
30 procedure SendIPCXY(cmd: char; X, Y: SmallInt); |
32 procedure SendIPCRaw(p: pointer; len: Longword); |
31 procedure SendIPCRaw(p: pointer; len: Longword); |
33 procedure SendIPCAndWaitReply(s: shortstring); |
32 procedure SendIPCAndWaitReply(s: shortstring); |
34 procedure SendKeepAliveMessage(Lag: Longword); |
33 procedure SendKeepAliveMessage(Lag: Longword); |
35 procedure LoadRecordFromFile(fileName: shortstring); |
34 procedure LoadRecordFromFile(fileName: shortstring); |
115 procedure ParseIPCCommand(s: shortstring); |
114 procedure ParseIPCCommand(s: shortstring); |
116 var loTicks: Word; |
115 var loTicks: Word; |
117 begin |
116 begin |
118 case s[1] of |
117 case s[1] of |
119 '!': begin AddFileLog('Ping? Pong!'); isPonged:= true; end; |
118 '!': begin AddFileLog('Ping? Pong!'); isPonged:= true; end; |
120 '?': SendIPCc('!'); |
119 '?': SendIPC(_S'!'); |
121 'e': ParseCommand(copy(s, 2, Length(s) - 1), true); |
120 'e': ParseCommand(copy(s, 2, Length(s) - 1), true); |
122 'E': OutError(copy(s, 2, Length(s) - 1), true); |
121 'E': OutError(copy(s, 2, Length(s) - 1), true); |
123 'W': OutError(copy(s, 2, Length(s) - 1), false); |
122 'W': OutError(copy(s, 2, Length(s) - 1), false); |
124 'M': ParseCommand('landcheck ' + s, true); |
123 'M': ParseCommand('landcheck ' + s, true); |
125 'T': case s[2] of |
124 'T': case s[2] of |
220 inc(s[0], 2); |
219 inc(s[0], 2); |
221 SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0]))) |
220 SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0]))) |
222 end |
221 end |
223 end; |
222 end; |
224 |
223 |
225 procedure SendIPCc(c: char); |
|
226 var s: shortstring; |
|
227 begin |
|
228 s[0]:= #1; |
|
229 s[1]:= c; |
|
230 SendIPC(s); |
|
231 end; |
|
232 |
|
233 procedure SendIPCRaw(p: pointer; len: Longword); |
224 procedure SendIPCRaw(p: pointer; len: Longword); |
234 begin |
225 begin |
235 if IPCSock <> nil then |
226 if IPCSock <> nil then |
236 begin |
227 begin |
237 SDLNet_TCP_Send(IPCSock, p, len) |
228 SDLNet_TCP_Send(IPCSock, p, len) |
258 end; |
249 end; |
259 |
250 |
260 procedure SendIPCAndWaitReply(s: shortstring); |
251 procedure SendIPCAndWaitReply(s: shortstring); |
261 begin |
252 begin |
262 SendIPC(s); |
253 SendIPC(s); |
263 SendIPCc('?'); |
254 SendIPC(_S'?'); |
264 IPCWaitPongEvent |
255 IPCWaitPongEvent |
265 end; |
256 end; |
266 |
257 |
267 procedure SendKeepAliveMessage(Lag: Longword); |
258 procedure SendKeepAliveMessage(Lag: Longword); |
268 begin |
259 begin |
269 inc(SendEmptyPacketTicks, Lag); |
260 inc(SendEmptyPacketTicks, Lag); |
270 if (SendEmptyPacketTicks >= cSendEmptyPacketTime) then |
261 if (SendEmptyPacketTicks >= cSendEmptyPacketTime) then |
271 SendIPCc('+') |
262 SendIPC(_S'+') |
272 end; |
263 end; |
273 |
264 |
274 procedure NetGetNextCmd; |
265 procedure NetGetNextCmd; |
275 var tmpflag: boolean; |
266 var tmpflag: boolean; |
276 s: shortstring; |
267 s: shortstring; |