23 uses SDLh, uTypes; |
23 uses SDLh, uTypes; |
24 |
24 |
25 procedure initModule; |
25 procedure initModule; |
26 procedure freeModule; |
26 procedure freeModule; |
27 |
27 |
|
28 procedure InitIPC; |
28 procedure SendIPC(s: shortstring); |
29 procedure SendIPC(s: shortstring); |
29 procedure SendIPCc(c: char); |
30 procedure SendIPCc(c: char); |
30 procedure SendIPCXY(cmd: char; X, Y: SmallInt); |
31 procedure SendIPCXY(cmd: char; X, Y: SmallInt); |
31 procedure SendIPCRaw(p: pointer; len: Longword); |
32 procedure SendIPCRaw(p: pointer; len: Longword); |
32 procedure SendIPCAndWaitReply(s: shortstring); |
33 procedure SendIPCAndWaitReply(s: shortstring); |
33 procedure SendKeepAliveMessage(Lag: Longword); |
34 procedure SendKeepAliveMessage(Lag: Longword); |
34 procedure LoadRecordFromFile(fileName: shortstring); |
35 procedure LoadRecordFromFile(fileName: shortstring); |
35 procedure SendStat(sit: TStatInfoType; s: shortstring); |
36 procedure SendStat(sit: TStatInfoType; s: shortstring); |
36 procedure IPCWaitPongEvent; |
37 procedure IPCWaitPongEvent; |
37 procedure IPCCheckSock; |
38 procedure IPCCheckSock; |
38 procedure InitIPC; |
|
39 procedure CloseIPC; |
|
40 procedure NetGetNextCmd; |
39 procedure NetGetNextCmd; |
41 procedure doPut(putX, putY: LongInt; fromAI: boolean); |
40 procedure doPut(putX, putY: LongInt; fromAI: boolean); |
42 |
41 |
43 implementation |
42 implementation |
44 uses uConsole, uConsts, uVariables, uCommands, uUtils, uDebug; |
43 uses uConsole, uConsts, uVariables, uCommands, uUtils, uDebug; |
108 SDLTry(SDLNet_ResolveHost(ipaddr, PChar('127.0.0.1'), ipcPort) = 0, true); |
107 SDLTry(SDLNet_ResolveHost(ipaddr, PChar('127.0.0.1'), ipcPort) = 0, true); |
109 {$HINTS ON} |
108 {$HINTS ON} |
110 IPCSock:= SDLNet_TCP_Open(ipaddr); |
109 IPCSock:= SDLNet_TCP_Open(ipaddr); |
111 SDLTry(IPCSock <> nil, true); |
110 SDLTry(IPCSock <> nil, true); |
112 WriteLnToConsole(msgOK) |
111 WriteLnToConsole(msgOK) |
113 end; |
|
114 |
|
115 procedure CloseIPC; |
|
116 begin |
|
117 SDLNet_FreeSocketSet(fds); |
|
118 SDLNet_TCP_Close(IPCSock); |
|
119 SDLNet_Quit(); |
|
120 end; |
112 end; |
121 |
113 |
122 procedure ParseIPCCommand(s: shortstring); |
114 procedure ParseIPCCommand(s: shortstring); |
123 var loTicks: Word; |
115 var loTicks: Word; |
124 begin |
116 begin |