--- a/hedgewars/uScript.pas Fri Sep 22 18:07:11 2017 -0400
+++ b/hedgewars/uScript.pas Fri Sep 22 18:45:51 2017 -0400
@@ -3015,7 +3015,10 @@
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
- AddRandomness(byte(mybuf[i]));
+ begin
+ AddRandomness(byte(mybuf[i])); // wish I had the seed...
+ CheckSum := CheckSum xor GetRandom($FFFFFFFF);
+ end;
lastChar := mybuf[i];
if (byte(mybuf[i]) = $0D) or (byte(mybuf[i]) = $0A) then
inComment := false
@@ -3034,7 +3037,7 @@
begin
if not inComment and (mybuf[i] = '"') and (lastChar <> '\') then
inQuote := not inQuote;
- if (lastChar = '-') and (mybuf[i] = '-') then
+ if not inQuote and (lastChar = '-') and (mybuf[i] = '-') then
inComment := true;
if not inComment and not inQuote then
locSum := locSum xor (byte(mybuf[i]) shl (i mod 4));
@@ -3092,7 +3095,6 @@
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