Save some memory
authorunc0rr
Sat, 21 Jul 2007 15:45:41 +0000
changeset 566 1c1cb593cb81
parent 565 092cb8deffc5
child 567 b6de36975a3c
Save some memory
hedgewars/hwengine.dpr
hedgewars/uLand.pas
--- a/hedgewars/hwengine.dpr	Sat Jul 21 12:29:09 2007 +0000
+++ b/hedgewars/hwengine.dpr	Sat Jul 21 15:45:41 2007 +0000
@@ -268,6 +268,7 @@
 
 /////////////////////////
 procedure GenLandPreview;
+var Preview: TPreview;
 begin
 InitIPC;
 IPCWaitPongEvent;
@@ -275,7 +276,7 @@
       'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')',
       true);
 
-GenPreview;
+Preview:= GenPreview;
 WriteLnToConsole('Sending preview...');
 SendIPCRaw(@Preview, sizeof(Preview));
 WriteLnToConsole('Preview sent, disconnect');
--- a/hedgewars/uLand.pas	Sat Jul 21 12:29:09 2007 +0000
+++ b/hedgewars/uLand.pas	Sat Jul 21 15:45:41 2007 +0000
@@ -25,10 +25,9 @@
 
 var  Land: TLandArray;
      LandSurface: PSDL_Surface;
-     Preview: TPreview;
 
 procedure GenMap;
-procedure GenPreview;
+function GenPreview: TPreview;
 procedure CheckLandDigest(s: shortstring);
 
 implementation
@@ -603,8 +602,9 @@
 {$IFDEF DEBUGFILE}LogLandDigest{$ENDIF}
 end;
 
-procedure GenPreview;
+function GenPreview: TPreview;
 var x, y, xx, yy, t, bit: LongInt;
+    Preview: TPreview;
 begin
 WriteLnToConsole('Generating preview...');
 GenBlank(EdgeTemplates[SelectTemplate]);
@@ -621,7 +621,8 @@
                     if Land[yy, xx] <> 0 then inc(t);
             if t > 8 then Preview[y, x]:= Preview[y, x] or ($80 shr bit)
             end
-        end
+        end;
+GenPreview:= Preview
 end;
 
 initialization