hedgewars/uLand.pas
changeset 4389 d1c65b60cd68
parent 4377 43945842da0c
child 4398 36d7e4b6ca81
equal deleted inserted replaced
4388:b14e24444bca 4389:d1c65b60cd68
    30 
    30 
    31 procedure initModule;
    31 procedure initModule;
    32 procedure freeModule;
    32 procedure freeModule;
    33 procedure GenMap;
    33 procedure GenMap;
    34 function  GenPreview: TPreview;
    34 function  GenPreview: TPreview;
    35 procedure CheckLandDigest(s: shortstring);
       
    36 
    35 
    37 implementation
    36 implementation
    38 uses uConsole, uStore, uRandom, uLandObjects, Adler32, uIO, uLandTexture, sysutils,
    37 uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, sysutils,
    39      uVariables, uUtils;
    38      uVariables, uUtils;
    40 
    39 
    41 operator=(const a, b: direction) c: Boolean;
    40 operator=(const a, b: direction) c: Boolean;
    42 begin
    41 begin
    43     c := (a.x = b.x) and (a.y = b.y);
    42     c := (a.x = b.x) and (a.y = b.y);
    45 
    44 
    46 type TPixAr = record
    45 type TPixAr = record
    47               Count: Longword;
    46               Count: Longword;
    48               ar: array[0..Pred(cMaxEdgePoints)] of TPoint;
    47               ar: array[0..Pred(cMaxEdgePoints)] of TPoint;
    49               end;
    48               end;
    50 
       
    51 procedure LogLandDigest;
       
    52 var s: shortstring;
       
    53     adler, i: LongInt;
       
    54 begin
       
    55 adler:= 1;
       
    56 for i:= 0 to LAND_HEIGHT-1 do
       
    57     Adler32Update(adler, @Land[i,0], LAND_WIDTH);
       
    58 s:= 'M'+inttostr(adler);
       
    59 
       
    60 CheckLandDigest(s);
       
    61 SendIPCRaw(@s[0], Length(s) + 1)
       
    62 end;
       
    63 
       
    64 procedure CheckLandDigest(s: shortstring);
       
    65 begin
       
    66 {$IFDEF DEBUGFILE}
       
    67     AddFileLog('CheckLandDigest: ' + s + ' digest : ' + digest);
       
    68 {$ENDIF}
       
    69     if digest = '' then
       
    70         digest:= s
       
    71     else
       
    72         TryDo(s = digest, 'Different maps generated, sorry', true);
       
    73 end;
       
    74 
    49 
    75 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
    50 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
    76 var
    51 var
    77   eX, eY, dX, dY: LongInt;
    52   eX, eY, dX, dY: LongInt;
    78   i, sX, sY, x, y, d: LongInt;
    53   i, sX, sY, x, y, d: LongInt;
  1210     else
  1185     else
  1211         MakeFortsMap;
  1186         MakeFortsMap;
  1212 
  1187 
  1213     AddProgress;
  1188     AddProgress;
  1214 
  1189 
  1215 {$IFDEF DEBUGFILE}LogLandDigest;{$ENDIF}
       
  1216 
       
  1217 // check for land near top
  1190 // check for land near top
  1218 c:= 0;
  1191 c:= 0;
  1219 if (GameFlags and gfBorder) <> 0 then
  1192 if (GameFlags and gfBorder) <> 0 then
  1220     hasBorder:= true
  1193     hasBorder:= true
  1221 else
  1194 else