hedgewars/uLand.pas
changeset 13830 1f15b0ee8e34
parent 13822 381e37c6d5d9
child 14303 6015b74eea55
--- a/hedgewars/uLand.pas	Mon Sep 24 11:16:08 2018 -0400
+++ b/hedgewars/uLand.pas	Mon Sep 24 11:18:48 2018 -0400
@@ -873,6 +873,7 @@
 if (WorldEdge <> weNone) and (not hasBorder) then
     InitWorldEdges();
 
+ScriptSetMapGlobals;
 end;
 
 procedure GenPreview(out Preview: TPreview);
@@ -889,6 +890,8 @@
         OutError('Unknown mapgen', true);
     end;
 
+    ScriptSetMapGlobals;
+
     // strict scaling needed here since preview assumes a rectangle
     rh:= max(LAND_HEIGHT,2048);
     rw:= max(LAND_WIDTH,4096);
@@ -938,6 +941,8 @@
         OutError('Unknown mapgen', true);
     end;
 
+    ScriptSetMapGlobals;
+
     // strict scaling needed here since preview assumes a rectangle
     rh:= max(LAND_HEIGHT, 2048);
     rw:= max(LAND_WIDTH, 4096);
@@ -979,12 +984,14 @@
 
 procedure chSendLandDigest(var s: shortstring);
 var i: LongInt;
+	landPixelDigest  : LongInt;	
 begin
+	landPixelDigest:= 1;
     for i:= 0 to LAND_HEIGHT-1 do
-        syncedPixelDigest:= Adler32Update(syncedPixelDigest, @Land[i,0], LAND_WIDTH*2);
-    s:= 'M' + IntToStr(syncedPixelDigest); // + cScriptName; script name is no longer needed. scripts are hashed
+        landPixelDigest:= Adler32Update(landPixelDigest, @Land[i,0], LAND_WIDTH*2);
+    s:= 'M' + IntToStr(syncedPixelDigest)+'|'+IntToStr(landPixelDigest);
 
-    ScriptSetString('LandDigest', s);
+    ScriptSetString('LandDigest',IntToStr(landPixelDigest));
 
     chLandCheck(s);
     if allOK then SendIPCRaw(@s[0], Length(s) + 1)