# HG changeset patch # User unc0rr # Date 1353250726 -14400 # Node ID 341fa76d07497e075906e9a2eb3461a52af57f90 # Parent 07661fb20586d31ca9024ca8f9160f17d44156e4 Convert reading hedgehogs limit from map config diff -r 07661fb20586 -r 341fa76d0749 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Sun Nov 18 18:52:58 2012 +0400 +++ b/hedgewars/uLand.pas Sun Nov 18 18:58:46 2012 +0400 @@ -31,7 +31,7 @@ implementation uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, SysUtils, uVariables, uUtils, uCommands, adler32, uDebug, uLandPainted, uTextures, - uLandGenMaze, uLandOutline; + uLandGenMaze, uLandOutline, uPhysFSLayer; var digest: shortstring; @@ -423,26 +423,26 @@ end; procedure LoadMapConfig; -var f: textfile; +var f: PFSFile; s: shortstring; begin s:= cPathz[ptMapCurrent] + '/map.cfg'; WriteLnToConsole('Fetching map HH limit'); -{$I-} -Assign(f, s); -filemode:= 0; // readonly -Reset(f); -if IOResult <> 0 then + +f:= pfsOpenRead(s); +if f <> nil then begin - s:= cPathz[ptMissionMaps] + '/' + ExtractFileName(cPathz[ptMapCurrent]) + '/map.cfg'; - Assign(f, s); - Reset(f); + pfsReadLn(f, s); + if not pfsEof(f) then + begin + pfsReadLn(f, s); + val(s, MaxHedgehogs) + end; + + pfsClose(f) end; -Readln(f); -if not eof(f) then - Readln(f, MaxHedgehogs); -{$I+} + if (MaxHedgehogs = 0) then MaxHedgehogs:= 18; end;