hedgewars/uLand.pas
changeset 3532 04e2fea3e83a
parent 3526 a1d2180fef42
child 3551 d4de36b3801a
equal deleted inserted replaced
3527:c4e0ef164162 3532:04e2fea3e83a
    55 function  GenPreview: TPreview;
    55 function  GenPreview: TPreview;
    56 procedure CheckLandDigest(s: shortstring);
    56 procedure CheckLandDigest(s: shortstring);
    57 function  LandBackPixel(x, y: LongInt): LongWord;
    57 function  LandBackPixel(x, y: LongInt): LongWord;
    58 
    58 
    59 implementation
    59 implementation
    60 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uLandTexture;
    60 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, Adler32, uIO, uLandTexture;
    61 
    61 
    62 operator=(const a, b: direction) c: Boolean;
    62 operator=(const a, b: direction) c: Boolean;
    63 begin
    63 begin
    64     c := (a.x = b.x) and (a.y = b.y);
    64     c := (a.x = b.x) and (a.y = b.y);
    65 end;
    65 end;
    68               Count: Longword;
    68               Count: Longword;
    69               ar: array[0..Pred(cMaxEdgePoints)] of TPoint;
    69               ar: array[0..Pred(cMaxEdgePoints)] of TPoint;
    70               end;
    70               end;
    71 
    71 
    72 procedure LogLandDigest;
    72 procedure LogLandDigest;
    73 var ctx: TSHA1Context;
    73 var s: shortstring;
    74     dig: TSHA1Digest;
    74     adler: LongInt;
    75     s: shortstring;
    75 begin
    76 begin
    76 adler:= 1;
    77 {$HINTS OFF}
    77 Adler32Update(adler, @Land, sizeof(Land));
    78 SHA1Init(ctx);
    78 s:= 'M'+inttostr(adler);
    79 {$HINTS ON}
    79 
    80 SHA1UpdateLongwords(ctx, @Land, sizeof(Land));
       
    81 dig:= SHA1Final(ctx);
       
    82 s:='M{'+inttostr(dig[0])+':'
       
    83        +inttostr(dig[1])+':'
       
    84        +inttostr(dig[2])+':'
       
    85        +inttostr(dig[3])+':'
       
    86        +inttostr(dig[4])+'}';
       
    87 CheckLandDigest(s);
    80 CheckLandDigest(s);
    88 SendIPCRaw(@s[0], Length(s) + 1)
    81 SendIPCRaw(@s[0], Length(s) + 1)
    89 end;
    82 end;
    90 
    83 
    91 procedure CheckLandDigest(s: shortstring);
    84 procedure CheckLandDigest(s: shortstring);