hedgewars/uIO.pas
changeset 4376 9654205a9424
parent 4374 bcefeeabaa33
child 4377 43945842da0c
equal deleted inserted replaced
4375:ae5507ddb989 4376:9654205a9424
    18 
    18 
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uIO;
    21 unit uIO;
    22 interface
    22 interface
    23 uses SDLh;
    23 uses SDLh, uTypes;
    24 
    24 
    25 var ipcPort: Word = 0;
    25 var ipcPort: Word = 0;
    26     hiTicks: Word;
    26     hiTicks: Word;
    27 
    27 
    28 procedure initModule;
    28 procedure initModule;
    33 procedure SendIPCRaw(p: pointer; len: Longword);
    33 procedure SendIPCRaw(p: pointer; len: Longword);
    34 procedure SendIPCAndWaitReply(s: shortstring);
    34 procedure SendIPCAndWaitReply(s: shortstring);
    35 procedure SendIPCTimeInc;
    35 procedure SendIPCTimeInc;
    36 procedure SendKeepAliveMessage(Lag: Longword);
    36 procedure SendKeepAliveMessage(Lag: Longword);
    37 procedure LoadRecordFromFile(fileName: shortstring);
    37 procedure LoadRecordFromFile(fileName: shortstring);
       
    38 procedure SendStat(sit: TStatInfoType; s: shortstring);
    38 procedure IPCWaitPongEvent;
    39 procedure IPCWaitPongEvent;
    39 procedure IPCCheckSock;
    40 procedure IPCCheckSock;
    40 procedure InitIPC;
    41 procedure InitIPC;
    41 procedure CloseIPC;
    42 procedure CloseIPC;
    42 procedure NetGetNextCmd;
    43 procedure NetGetNextCmd;
    43 
    44 
    44 implementation
    45 implementation
    45 uses uConsole, uConsts, uMisc, uLand, uChat, uTeams, uTypes, uVariables, uCommands, uUtils;
    46 uses uConsole, uConsts, uMisc, uLand, uChat, uTeams, uVariables, uCommands, uUtils;
    46 
    47 
    47 type PCmd = ^TCmd;
    48 type PCmd = ^TCmd;
    48      TCmd = packed record
    49      TCmd = packed record
    49             Next: PCmd;
    50             Next: PCmd;
    50             loTime: Word;
    51             loTime: Word;
   199             end
   200             end
   200         end
   201         end
   201 until i = 0;
   202 until i = 0;
   202 
   203 
   203 close(f)
   204 close(f)
       
   205 end;
       
   206 
       
   207 procedure SendStat(sit: TStatInfoType; s: shortstring);
       
   208 const stc: array [TStatInfoType] of char = 'rDkKHTPsSB';
       
   209 var buf: shortstring;
       
   210 begin
       
   211 buf:= 'i' + stc[sit] + s;
       
   212 SendIPCRaw(@buf[0], length(buf) + 1)
   204 end;
   213 end;
   205 
   214 
   206 procedure SendIPC(s: shortstring);
   215 procedure SendIPC(s: shortstring);
   207 begin
   216 begin
   208 if IPCSock <> nil then
   217 if IPCSock <> nil then