use pitch for surfaces, land_width x2 since 16 bit
authornemo
Tue, 24 Oct 2017 18:28:59 -0400
changeset 12763 49c31d8cc740
parent 12762 6f4ab0339c16
child 12764 df9d9d19406a
use pitch for surfaces, land_width x2 since 16 bit
hedgewars/adler32.pas
hedgewars/uLand.pas
hedgewars/uLandObjects.pas
hedgewars/uStore.pas
--- a/hedgewars/adler32.pas	Tue Oct 24 21:59:06 2017 +0200
+++ b/hedgewars/adler32.pas	Tue Oct 24 18:28:59 2017 -0400
@@ -65,7 +65,7 @@
 Also, the structure was removed to simplify C conversion
 *)
 
-function Adler32Update (var adler : longint; Msg     :Pointer; Len     :longint ) : longint;
+function Adler32Update (adler : longint; Msg     :Pointer; Len     :longint ) : longint;
 
 implementation
 
@@ -123,7 +123,7 @@
 end;
 *)
 
-function Adler32Update(var adler:longint; Msg: Pointer; Len :longint) : longint;
+function Adler32Update(adler:longint; Msg: Pointer; Len :longint) : longint;
     {-update Adler32 with Msg data}
     const
         BASE = 65521; {max. prime < 65536 }
--- a/hedgewars/uLand.pas	Tue Oct 24 21:59:06 2017 +0200
+++ b/hedgewars/uLand.pas	Tue Oct 24 18:28:59 2017 -0400
@@ -985,7 +985,7 @@
 var i: LongInt;
 begin
     for i:= 0 to LAND_HEIGHT-1 do
-        syncedPixelDigest:= Adler32Update(syncedPixelDigest, @Land[i,0], LAND_WIDTH);
+        syncedPixelDigest:= Adler32Update(syncedPixelDigest, @Land[i,0], LAND_WIDTH*2);
     s:= 'M' + IntToStr(syncedPixelDigest); // + cScriptName; script name is no longer needed. scripts are hashed
 
     ScriptSetString('LandDigest', s);
--- a/hedgewars/uLandObjects.pas	Tue Oct 24 21:59:06 2017 +0200
+++ b/hedgewars/uLandObjects.pas	Tue Oct 24 18:28:59 2017 -0400
@@ -262,7 +262,7 @@
     girSurf:= LoadDataImageAltPath(ptCurrTheme, ptGraphics, 'Girder', ifCritical or ifColorKey or ifIgnoreCaps);
 
 for y := 0 to girsurf^.h-1 do
-    syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PLongWordArray(girsurf^.pixels)^[y*girsurf^.w], girsurf^.w);
+    syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PByteArray(girsurf^.pixels)^[y*girsurf^.pitch], girsurf^.w);
 
 girderHeight:= girSurf^.h;
 
@@ -699,7 +699,7 @@
             if (Maxcnt < 1) or (Maxcnt > MAXTHEMEOBJECTS) then
                 OutError('Object''s max count should be between 1 and '+ inttostr(MAXTHEMEOBJECTS) +' (it was '+ inttostr(Maxcnt) +').', true);
             for y := 0 to Surf^.h-1 do
-                syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PLongWordArray(Surf^.pixels)^[y*Surf^.w], Surf^.w);
+                syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PByteArray(Surf^.pixels)^[y*Surf^.pitch], Surf^.w);
 
             inrectcnt := 0;
 
--- a/hedgewars/uStore.pas	Tue Oct 24 21:59:06 2017 +0200
+++ b/hedgewars/uStore.pas	Tue Oct 24 18:28:59 2017 -0400
@@ -473,7 +473,7 @@
 {$ELSE}
                     if checkSum then
                         for y := 0 to tmpsurf^.h-1 do
-                            syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PLongWordArray(tmpsurf^.pixels)^[y*tmpsurf^.w], tmpsurf^.w);
+                            syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PByteArray(tmpsurf^.pixels)^[y*tmpsurf^.pitch], tmpsurf^.w);
 
                     if saveSurf then
                         Surface:= tmpsurf