# HG changeset patch # User unc0rr # Date 1169835063 0 # Node ID bc3c3edc5ce1657d29a76d852539b25587d9bd81 # Parent dc50b7933390bc865f1d06e2c6272f63de1a3182 Check land digest diff -r dc50b7933390 -r bc3c3edc5ce1 hedgewars/uIO.pas --- a/hedgewars/uIO.pas Fri Jan 26 18:05:49 2007 +0000 +++ b/hedgewars/uIO.pas Fri Jan 26 18:11:03 2007 +0000 @@ -80,6 +80,7 @@ 'e': ParseCommand(copy(s, 2, Length(s) - 1), true); 'E': OutError(copy(s, 2, Length(s) - 1), true); 'W': OutError(copy(s, 2, Length(s) - 1), false); + 'M': CheckLandDigest(s); 'T': case s[2] of 'L': GameType:= gmtLocal; 'D': GameType:= gmtDemo; diff -r dc50b7933390 -r bc3c3edc5ce1 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Fri Jan 26 18:05:49 2007 +0000 +++ b/hedgewars/uLand.pas Fri Jan 26 18:11:03 2007 +0000 @@ -29,7 +29,7 @@ procedure GenMap; procedure GenPreview; - +procedure CheckLandDigest(s: shortstring); implementation uses uConsole, uStore, uMisc, uConsts, uRandom, uTeams, uLandObjects, uSHA, uIO; @@ -47,12 +47,22 @@ SHA1Init(ctx); SHA1Update(ctx, @Land, sizeof(Land)); dig:= SHA1Final(ctx); -s:= '{'+inttostr(dig[0])+':' +s:='M{'+inttostr(dig[0])+':' +inttostr(dig[1])+':' +inttostr(dig[2])+':' +inttostr(dig[3])+':' +inttostr(dig[4])+'}'; -//SendIPC('M' + s) +CheckLandDigest(s); +SendIPCRaw(@s[0], Length(s) + 1) +end; + +procedure CheckLandDigest(s: shortstring); +const digest: shortstring = ''; +begin +if digest = '' then + digest:= s +else + TryDo(s = digest, 'Different maps generated, sorry', true) end; procedure DrawLine(X1, Y1, X2, Y2: integer; Color: Longword);