# HG changeset patch
# User unc0rr
# Date 1158874142 0
# Node ID 63909aecb0edd1e8f012d81ce3cb637d794c53ce
# Parent  e6c3223f3bca30ae5f03af47488f40a8f645b1b1
Preview stream doesn't need parsing now

diff -r e6c3223f3bca -r 63909aecb0ed hedgewars/hwengine.dpr
--- a/hedgewars/hwengine.dpr	Thu Sep 21 18:10:45 2006 +0000
+++ b/hedgewars/hwengine.dpr	Thu Sep 21 21:29:02 2006 +0000
@@ -256,12 +256,15 @@
 procedure GenLandPreview;
 begin
 InitIPC;
-SendIPCAndWaitReply('C');
+IPCWaitPongEvent;
 TryDo(InitStepsFlags = cifRandomize,
       'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')',
       true);
+WriteLnToConsole('Generating preview...');
 GenPreview;
+WriteLnToConsole('Sending preview...');
 SendIPCRaw(@Preview, sizeof(Preview));
+WriteLnToConsole('Preview sent, disconnect');
 CloseIPC
 end;
 
diff -r e6c3223f3bca -r 63909aecb0ed hedgewars/uIO.pas
--- a/hedgewars/uIO.pas	Thu Sep 21 18:10:45 2006 +0000
+++ b/hedgewars/uIO.pas	Thu Sep 21 21:29:02 2006 +0000
@@ -42,6 +42,7 @@
 procedure SendIPCXY(cmd: char; X, Y: SmallInt);
 procedure SendIPCRaw(p: pointer; len: Longword);
 procedure SendIPCAndWaitReply(s: shortstring);
+procedure IPCWaitPongEvent;
 procedure IPCCheckSock;
 procedure InitIPC;
 procedure CloseIPC;
@@ -161,10 +162,8 @@
 SendIPC(s)
 end;
 
-procedure SendIPCAndWaitReply(s: shortstring);
+procedure IPCWaitPongEvent;
 begin
-SendIPC(s);
-SendIPC('?');
 isPonged:= false;
 repeat
    IPCCheckSock;
@@ -172,6 +171,13 @@
 until isPonged
 end;
 
+procedure SendIPCAndWaitReply(s: shortstring);
+begin
+SendIPC(s);
+SendIPC('?');
+IPCWaitPongEvent
+end;
+
 procedure NetGetNextCmd;
 var tmpflag: boolean;
 begin