hedgewars/uPhysFSLayer.pas
changeset 8107 ee21b816394f
parent 8080 a6fc5396b3d6
child 8134 38e163cc3bfd
--- a/hedgewars/uPhysFSLayer.pas	Fri Nov 23 10:43:15 2012 +0100
+++ b/hedgewars/uPhysFSLayer.pas	Fri Nov 23 13:08:50 2012 +0400
@@ -30,6 +30,7 @@
 function pfsClose(f: PFSFile): boolean;
 
 procedure pfsReadLn(f: PFSFile; var s: shortstring);
+procedure pfsReadLnA(f: PFSFile; var s: ansistring);
 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64;
 function pfsEOF(f: PFSFile): boolean;
 
@@ -99,6 +100,28 @@
         end
 end;
 
+procedure pfsReadLnA(f: PFSFile; var s: ansistring);
+var c: char;
+    b: shortstring;
+begin
+s:= '';
+b[0]:= #0;
+
+while (PHYSFS_readBytes(f, @c, 1) = 1) and (c <> #10) do
+    if (c <> #13) then
+        begin
+        inc(b[0]);
+        b[byte(b[0])]:= c;
+        if b[0] = #255 then
+            begin
+            s:= s + b;
+            b[0]:= #0
+            end
+        end;
+        
+s:= s + b
+end;
+
 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64;
 var r: Int64;
 begin