hedgewars/uScript.pas
changeset 12493 f3d6f1b0b59d
parent 12459 06bf46238a89
child 12494 1b483882b60f
--- a/hedgewars/uScript.pas	Fri Sep 22 23:07:52 2017 +0200
+++ b/hedgewars/uScript.pas	Fri Sep 22 18:07:11 2017 -0400
@@ -3015,7 +3015,7 @@
                         inComment := true
                     // gonna add any non-magic whitespace and skip - just to make comment avoidance easier
                     else if not inComment and (byte(mybuf[i]) > $20) and (byte(mybuf[i]) < $7F) and (mybuf[i]<>'-') then
-                       CheckSum := CheckSum xor (byte(mybuf[i]) shl (i mod 4));
+                        AddRandomness(byte(mybuf[i]));
                     lastChar := mybuf[i];
                     if (byte(mybuf[i]) = $0D) or (byte(mybuf[i]) = $0A) then
                         inComment := false 
@@ -3092,6 +3092,7 @@
      ret:= lua_load(luaState, @ScriptLocaleReader, f, Str2PChar(s))
 else ret:= lua_load(luaState, @ScriptReader, f, Str2PChar(s));
 pfsClose(f);
+CheckSum := CheckSum xor GetRandom($FFFFFFFF);
 
 if ret <> 0 then
     begin