hedgewars/uIO.pas
changeset 49 3afe33c1cf06
parent 48 0f396d0c429d
child 53 0e27949850e3
equal deleted inserted replaced
48:0f396d0c429d 49:3afe33c1cf06
    47 procedure LoadFortPoints(Fort: shortstring; isRight: boolean; Count: Longword);
    47 procedure LoadFortPoints(Fort: shortstring; isRight: boolean; Count: Longword);
    48 
    48 
    49 implementation
    49 implementation
    50 uses uConsole, uConsts, uWorld, uMisc, uRandom, uLand;
    50 uses uConsole, uConsts, uWorld, uMisc, uRandom, uLand;
    51 const isPonged: boolean = false;
    51 const isPonged: boolean = false;
    52 var  IPCSock: PTCPSocket;
    52 var  IPCSock: PTCPSocket = nil;
    53      fds: PSDLNet_SocketSet;
    53      fds: PSDLNet_SocketSet;
    54 
    54 
    55      extcmd: array[word] of packed record
    55      extcmd: array[word] of packed record
    56                                    Time: LongWord;
    56                                    Time: LongWord;
    57                                    case byte of
    57                                    case byte of
   132       end;
   132       end;
   133 end;
   133 end;
   134 
   134 
   135 procedure SendIPC(s: shortstring);
   135 procedure SendIPC(s: shortstring);
   136 begin
   136 begin
   137 //WriteLnToConsole(s);
   137 if IPCSock <> nil then
   138 if s[0]>#251 then s[0]:= #251;
   138    begin
   139 PLongWord(@s[Succ(byte(s[0]))])^:= GameTicks;
   139    if s[0]>#251 then s[0]:= #251;
   140 {$IFDEF DEBUGFILE}AddFileLog('IPC send: '+s);{$ENDIF}
   140    PLongWord(@s[Succ(byte(s[0]))])^:= GameTicks;
   141 inc(s[0],4);
   141    {$IFDEF DEBUGFILE}AddFileLog('IPC send: '+s);{$ENDIF}
   142 SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0])))
   142    inc(s[0],4);
       
   143    SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0])))
       
   144    end
   143 end;
   145 end;
   144 
   146 
   145 procedure SendIPCAndWaitReply(s: shortstring);
   147 procedure SendIPCAndWaitReply(s: shortstring);
   146 begin
   148 begin
   147 SendIPC(s);
   149 SendIPC(s);