changeset 367 | bc3c3edc5ce1 |
parent 365 | a26cec847dd7 |
child 368 | fe71e55d2d7b |
366:dc50b7933390 | 367:bc3c3edc5ce1 |
---|---|
27 LandSurface: PSDL_Surface; |
27 LandSurface: PSDL_Surface; |
28 Preview: TPreview; |
28 Preview: TPreview; |
29 |
29 |
30 procedure GenMap; |
30 procedure GenMap; |
31 procedure GenPreview; |
31 procedure GenPreview; |
32 |
32 procedure CheckLandDigest(s: shortstring); |
33 |
33 |
34 implementation |
34 implementation |
35 uses uConsole, uStore, uMisc, uConsts, uRandom, uTeams, uLandObjects, uSHA, uIO; |
35 uses uConsole, uStore, uMisc, uConsts, uRandom, uTeams, uLandObjects, uSHA, uIO; |
36 |
36 |
37 type TPixAr = record |
37 type TPixAr = record |
45 s: shortstring; |
45 s: shortstring; |
46 begin |
46 begin |
47 SHA1Init(ctx); |
47 SHA1Init(ctx); |
48 SHA1Update(ctx, @Land, sizeof(Land)); |
48 SHA1Update(ctx, @Land, sizeof(Land)); |
49 dig:= SHA1Final(ctx); |
49 dig:= SHA1Final(ctx); |
50 s:= '{'+inttostr(dig[0])+':' |
50 s:='M{'+inttostr(dig[0])+':' |
51 +inttostr(dig[1])+':' |
51 +inttostr(dig[1])+':' |
52 +inttostr(dig[2])+':' |
52 +inttostr(dig[2])+':' |
53 +inttostr(dig[3])+':' |
53 +inttostr(dig[3])+':' |
54 +inttostr(dig[4])+'}'; |
54 +inttostr(dig[4])+'}'; |
55 //SendIPC('M' + s) |
55 CheckLandDigest(s); |
56 SendIPCRaw(@s[0], Length(s) + 1) |
|
57 end; |
|
58 |
|
59 procedure CheckLandDigest(s: shortstring); |
|
60 const digest: shortstring = ''; |
|
61 begin |
|
62 if digest = '' then |
|
63 digest:= s |
|
64 else |
|
65 TryDo(s = digest, 'Different maps generated, sorry', true) |
|
56 end; |
66 end; |
57 |
67 |
58 procedure DrawLine(X1, Y1, X2, Y2: integer; Color: Longword); |
68 procedure DrawLine(X1, Y1, X2, Y2: integer; Color: Longword); |
59 var |
69 var |
60 eX, eY, dX, dY: integer; |
70 eX, eY, dX, dY: integer; |