equal
deleted
inserted
replaced
24 |
24 |
25 procedure initModule; |
25 procedure initModule; |
26 procedure freeModule; |
26 procedure freeModule; |
27 |
27 |
28 procedure SendIPC(s: shortstring); |
28 procedure SendIPC(s: shortstring); |
|
29 procedure SendIPCc(c: char); |
29 procedure SendIPCXY(cmd: char; X, Y: SmallInt); |
30 procedure SendIPCXY(cmd: char; X, Y: SmallInt); |
30 procedure SendIPCRaw(p: pointer; len: Longword); |
31 procedure SendIPCRaw(p: pointer; len: Longword); |
31 procedure SendIPCAndWaitReply(s: shortstring); |
32 procedure SendIPCAndWaitReply(s: shortstring); |
32 procedure SendKeepAliveMessage(Lag: Longword); |
33 procedure SendKeepAliveMessage(Lag: Longword); |
33 procedure LoadRecordFromFile(fileName: shortstring); |
34 procedure LoadRecordFromFile(fileName: shortstring); |
121 procedure ParseIPCCommand(s: shortstring); |
122 procedure ParseIPCCommand(s: shortstring); |
122 var loTicks: Word; |
123 var loTicks: Word; |
123 begin |
124 begin |
124 case s[1] of |
125 case s[1] of |
125 '!': begin AddFileLog('Ping? Pong!'); isPonged:= true; end; |
126 '!': begin AddFileLog('Ping? Pong!'); isPonged:= true; end; |
126 '?': SendIPC('!'); |
127 '?': SendIPCc('!'); |
127 'e': ParseCommand(copy(s, 2, Length(s) - 1), true); |
128 'e': ParseCommand(copy(s, 2, Length(s) - 1), true); |
128 'E': OutError(copy(s, 2, Length(s) - 1), true); |
129 'E': OutError(copy(s, 2, Length(s) - 1), true); |
129 'W': OutError(copy(s, 2, Length(s) - 1), false); |
130 'W': OutError(copy(s, 2, Length(s) - 1), false); |
130 'M': ParseCommand('landcheck ' + s, true); |
131 'M': ParseCommand('landcheck ' + s, true); |
131 'T': case s[2] of |
132 'T': case s[2] of |
227 inc(s[0], 2); |
228 inc(s[0], 2); |
228 SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0]))) |
229 SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0]))) |
229 end |
230 end |
230 end; |
231 end; |
231 |
232 |
|
233 procedure SendIPCc(c: char); |
|
234 var s: shortstring; |
|
235 begin |
|
236 s[0]:= #0; |
|
237 s[1]:= c; |
|
238 SendIPC(s); |
|
239 end; |
|
240 |
232 procedure SendIPCRaw(p: pointer; len: Longword); |
241 procedure SendIPCRaw(p: pointer; len: Longword); |
233 begin |
242 begin |
234 if IPCSock <> nil then |
243 if IPCSock <> nil then |
235 begin |
244 begin |
236 SDLNet_TCP_Send(IPCSock, p, len) |
245 SDLNet_TCP_Send(IPCSock, p, len) |
257 end; |
266 end; |
258 |
267 |
259 procedure SendIPCAndWaitReply(s: shortstring); |
268 procedure SendIPCAndWaitReply(s: shortstring); |
260 begin |
269 begin |
261 SendIPC(s); |
270 SendIPC(s); |
262 SendIPC('?'); |
271 SendIPCc('?'); |
263 IPCWaitPongEvent |
272 IPCWaitPongEvent |
264 end; |
273 end; |
265 |
274 |
266 procedure SendKeepAliveMessage(Lag: Longword); |
275 procedure SendKeepAliveMessage(Lag: Longword); |
267 begin |
276 begin |
268 inc(SendEmptyPacketTicks, Lag); |
277 inc(SendEmptyPacketTicks, Lag); |
269 if (SendEmptyPacketTicks >= cSendEmptyPacketTime) then |
278 if (SendEmptyPacketTicks >= cSendEmptyPacketTime) then |
270 SendIPC('+') |
279 SendIPCc('+') |
271 end; |
280 end; |
272 |
281 |
273 procedure NetGetNextCmd; |
282 procedure NetGetNextCmd; |
274 var tmpflag: boolean; |
283 var tmpflag: boolean; |
275 s: shortstring; |
284 s: shortstring; |