ranges for alnum were silly. also lets not fail to same value
authornemo
Wed, 20 Sep 2017 13:15:17 -0400
changeset 12464 06bf46238a89
parent 12463 3af8d755de17
child 12465 5eb227531589
ranges for alnum were silly. also lets not fail to same value
hedgewars/uScript.pas
--- a/hedgewars/uScript.pas	Wed Sep 20 11:00:43 2017 -0400
+++ b/hedgewars/uScript.pas	Wed Sep 20 13:15:17 2017 -0400
@@ -2997,6 +2997,7 @@
 
 var inComment: boolean;
 var inQuote: boolean;
+var locSum: LongWord;
 var braceCount: LongWord;
 var wordCount: LongWord;
 var lastChar: char;
@@ -3035,6 +3036,8 @@
                         inQuote := not inQuote;
                     if (lastChar = '-') and (mybuf[i] = '-') then
                         inComment := true;
+                    if not inComment and not inQuote then
+                       locSum := locSum xor (byte(mybuf[i]) shl (i mod 4));
                     if not inComment and not inQuote and 
                         ((mybuf[i] = '(') or 
                         (mybuf[i] = ')') or 
@@ -3042,13 +3045,13 @@
                         (mybuf[i] = '#') or 
                         (braceCount > 2) or
                         (wordCount > 6)) then 
-                       CheckSum := $deadbeef;
+                       CheckSum := locSum;
                     if not inComment and not inQuote and ((mybuf[i] = '{') or (mybuf[i] = '}')) then
                         inc(braceCount);
                     if not inComment and not inQuote and 
                         (((byte(mybuf[i]) > $40) and (byte(mybuf[i]) < $5B)) or
-                        ((byte(mybuf[i]) > $60) and (byte(mybuf[i]) < $6B)) or
-                        ((byte(mybuf[i]) >= $30) and (byte(mybuf[i]) < $40))) then
+                        ((byte(mybuf[i]) > $60) and (byte(mybuf[i]) < $7B)) or
+                        ((byte(mybuf[i]) >= $30) and (byte(mybuf[i]) < $3A))) then
                         inc(wordCount);
                     lastChar := mybuf[i];
                     if (byte(mybuf[i]) = $0D) or (byte(mybuf[i]) = $0A) then
@@ -3070,6 +3073,7 @@
 lastChar:= 'X';
 braceCount:= 0;
 wordCount:= 0;
+locSum:= 0;
 s:= cPathz[ptData] + name;
 if not pfsExists(s) then
     begin