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; |