Force a desync if there is a script name mismatch. This avoids playing until the game desyncs due to script differences.
authornemo
Mon, 31 Oct 2011 14:08:10 -0400
changeset 6254 e90fb60cb46d
parent 6253 d73317579ae4
child 6255 fd9ebc6feb12
Force a desync if there is a script name mismatch. This avoids playing until the game desyncs due to script differences.
hedgewars/uCommandHandlers.pas
hedgewars/uLand.pas
hedgewars/uVariables.pas
--- a/hedgewars/uCommandHandlers.pas	Mon Oct 31 19:40:39 2011 +0200
+++ b/hedgewars/uCommandHandlers.pas	Mon Oct 31 14:08:10 2011 -0400
@@ -130,6 +130,7 @@
 begin
 if s[1]='"' then Delete(s, 1, 1);
 if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
+cScriptName:= s;
 ScriptLoad(s)
 end;
 
--- a/hedgewars/uLand.pas	Mon Oct 31 19:40:39 2011 +0200
+++ b/hedgewars/uLand.pas	Mon Oct 31 14:08:10 2011 -0400
@@ -1439,7 +1439,7 @@
     adler:= 1;
     for i:= 0 to LAND_HEIGHT-1 do
         Adler32Update(adler, @Land[i,0], LAND_WIDTH);
-    s:= 'M' + IntToStr(adler);
+    s:= 'M' + IntToStr(adler) + cScriptName;
 
     chLandCheck(s);
     SendIPCRaw(@s[0], Length(s) + 1)
--- a/hedgewars/uVariables.pas	Mon Oct 31 19:40:39 2011 +0200
+++ b/hedgewars/uVariables.pas	Mon Oct 31 14:08:10 2011 -0400
@@ -126,6 +126,7 @@
     cLandMines      : Longword;
     cExplosives     : Longword;
 
+    cScriptName     : shortstring;
     cSeed           : shortstring;
     cVolumeDelta    : LongInt;
     cHasFocus       : boolean;
@@ -2500,6 +2501,7 @@
     isFirstFrame    := true;
     isSEBackup      := true;
     autoCameraOn    := true;
+    cScriptName     := '';
     cSeed           := '';
     cVolumeDelta    := 0;
     cHasFocus       := true;