hedgewars/uIO.pas
changeset 6898 344b0dbd9690
parent 6876 f588dfc27da3
child 6902 7d4e5ce73b98
equal deleted inserted replaced
6897:a9126661f613 6898:344b0dbd9690
   102     fds:= SDLNet_AllocSocketSet(1);
   102     fds:= SDLNet_AllocSocketSet(1);
   103     SDLTry(fds <> nil, true);
   103     SDLTry(fds <> nil, true);
   104     WriteLnToConsole(msgOK);
   104     WriteLnToConsole(msgOK);
   105     WriteToConsole('Establishing IPC connection to tcp 127.0.0.1:' + IntToStr(ipcPort) + ' ');
   105     WriteToConsole('Establishing IPC connection to tcp 127.0.0.1:' + IntToStr(ipcPort) + ' ');
   106     {$HINTS OFF}
   106     {$HINTS OFF}
   107     SDLTry(SDLNet_ResolveHost(ipaddr, '127.0.0.1', ipcPort) = 0, true);
   107     SDLTry(SDLNet_ResolveHost(ipaddr, PChar('127.0.0.1'), ipcPort) = 0, true);
   108     {$HINTS ON}
   108     {$HINTS ON}
   109     IPCSock:= SDLNet_TCP_Open(ipaddr);
   109     IPCSock:= SDLNet_TCP_Open(ipaddr);
   110     SDLTry(IPCSock <> nil, true);
   110     SDLTry(IPCSock <> nil, true);
   111     WriteLnToConsole(msgOK)
   111     WriteLnToConsole(msgOK)
   112 end;
   112 end;
   204 close(f)
   204 close(f)
   205 {$I+}
   205 {$I+}
   206 end;
   206 end;
   207 
   207 
   208 procedure SendStat(sit: TStatInfoType; s: shortstring);
   208 procedure SendStat(sit: TStatInfoType; s: shortstring);
   209 const stc: array [TStatInfoType] of char = 'rDkKHTPsSB';
   209 const stc: array [TStatInfoType] of char = ('r', 'D', 'k', 'K', 'H', 'T', 'P', 's', 'S', 'B');
   210 var buf: shortstring;
   210 var buf: shortstring;
   211 begin
   211 begin
   212 buf:= 'i' + stc[sit] + s;
   212 buf:= 'i' + stc[sit] + s;
   213 SendIPCRaw(@buf[0], length(buf) + 1)
   213 SendIPCRaw(@buf[0], length(buf) + 1)
   214 end;
   214 end;
   418             OutError('got /put while not being in choose target mode', false)
   418             OutError('got /put while not being in choose target mode', false)
   419 end;
   419 end;
   420 
   420 
   421 procedure initModule;
   421 procedure initModule;
   422 begin
   422 begin
   423     RegisterVariable('fatal', vtCommand, @chFatalError, true );
   423     RegisterVariable('fatal', @chFatalError, true );
   424 
   424 
   425     IPCSock:= nil;
   425     IPCSock:= nil;
   426 
   426 
   427     headcmd:= nil;
   427     headcmd:= nil;
   428     lastcmd:= nil;
   428     lastcmd:= nil;