hedgewars/uIO.pas
changeset 49 3afe33c1cf06
parent 48 0f396d0c429d
child 53 0e27949850e3
--- a/hedgewars/uIO.pas	Thu Jan 12 22:07:36 2006 +0000
+++ b/hedgewars/uIO.pas	Sun Jan 15 14:14:12 2006 +0000
@@ -49,7 +49,7 @@
 implementation
 uses uConsole, uConsts, uWorld, uMisc, uRandom, uLand;
 const isPonged: boolean = false;
-var  IPCSock: PTCPSocket;
+var  IPCSock: PTCPSocket = nil;
      fds: PSDLNet_SocketSet;
 
      extcmd: array[word] of packed record
@@ -134,12 +134,14 @@
 
 procedure SendIPC(s: shortstring);
 begin
-//WriteLnToConsole(s);
-if s[0]>#251 then s[0]:= #251;
-PLongWord(@s[Succ(byte(s[0]))])^:= GameTicks;
-{$IFDEF DEBUGFILE}AddFileLog('IPC send: '+s);{$ENDIF}
-inc(s[0],4);
-SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0])))
+if IPCSock <> nil then
+   begin
+   if s[0]>#251 then s[0]:= #251;
+   PLongWord(@s[Succ(byte(s[0]))])^:= GameTicks;
+   {$IFDEF DEBUGFILE}AddFileLog('IPC send: '+s);{$ENDIF}
+   inc(s[0],4);
+   SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0])))
+   end
 end;
 
 procedure SendIPCAndWaitReply(s: shortstring);