hedgewars/uScript.pas
changeset 12493 f3d6f1b0b59d
parent 12459 06bf46238a89
child 12494 1b483882b60f
equal deleted inserted replaced
12492:47be9f3e61e9 12493:f3d6f1b0b59d
  3013                 begin
  3013                 begin
  3014                     if (lastChar = '-') and (mybuf[i] = '-') then
  3014                     if (lastChar = '-') and (mybuf[i] = '-') then
  3015                         inComment := true
  3015                         inComment := true
  3016                     // gonna add any non-magic whitespace and skip - just to make comment avoidance easier
  3016                     // gonna add any non-magic whitespace and skip - just to make comment avoidance easier
  3017                     else if not inComment and (byte(mybuf[i]) > $20) and (byte(mybuf[i]) < $7F) and (mybuf[i]<>'-') then
  3017                     else if not inComment and (byte(mybuf[i]) > $20) and (byte(mybuf[i]) < $7F) and (mybuf[i]<>'-') then
  3018                        CheckSum := CheckSum xor (byte(mybuf[i]) shl (i mod 4));
  3018                         AddRandomness(byte(mybuf[i]));
  3019                     lastChar := mybuf[i];
  3019                     lastChar := mybuf[i];
  3020                     if (byte(mybuf[i]) = $0D) or (byte(mybuf[i]) = $0A) then
  3020                     if (byte(mybuf[i]) = $0D) or (byte(mybuf[i]) = $0A) then
  3021                         inComment := false 
  3021                         inComment := false 
  3022                 end;
  3022                 end;
  3023         end;
  3023         end;
  3090 physfsReaderSetBuffer(@buf);
  3090 physfsReaderSetBuffer(@buf);
  3091 if Pos('Locale/',s) <> 0 then
  3091 if Pos('Locale/',s) <> 0 then
  3092      ret:= lua_load(luaState, @ScriptLocaleReader, f, Str2PChar(s))
  3092      ret:= lua_load(luaState, @ScriptLocaleReader, f, Str2PChar(s))
  3093 else ret:= lua_load(luaState, @ScriptReader, f, Str2PChar(s));
  3093 else ret:= lua_load(luaState, @ScriptReader, f, Str2PChar(s));
  3094 pfsClose(f);
  3094 pfsClose(f);
       
  3095 CheckSum := CheckSum xor GetRandom($FFFFFFFF);
  3095 
  3096 
  3096 if ret <> 0 then
  3097 if ret <> 0 then
  3097     begin
  3098     begin
  3098     LuaError('Failed to load ' + name + '(error ' + IntToStr(ret) + ')');
  3099     LuaError('Failed to load ' + name + '(error ' + IntToStr(ret) + ')');
  3099     LuaError(lua_tostring(luaState, -1));
  3100     LuaError(lua_tostring(luaState, -1));