hedgewars/uLocale.pas
branchwebgl
changeset 8096 453917e94e55
parent 8026 4a4f21070479
parent 8028 dc30104660d3
child 8330 aaefa587e277
--- a/hedgewars/uLocale.pas	Wed Nov 14 00:23:29 2012 +0100
+++ b/hedgewars/uLocale.pas	Thu Nov 22 00:41:53 2012 +0100
@@ -34,14 +34,14 @@
 {$ENDIF}
 
 implementation
-uses uRandom, uUtils, uVariables, uDebug;
+uses uRandom, uUtils, uVariables, uDebug, uPhysFSLayer;
 
 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
     trevt_n: array[TEventId] of integer;
 
 procedure LoadLocale(FileName: shortstring);
-var s: ansistring;
-    f: textfile;
+var s: shortstring;
+    f: pfsFile;
     a, b, c: LongInt;
     first: array[TEventId] of boolean;
     e: TEventId;
@@ -51,18 +51,14 @@
 for e:= Low(TEventId) to High(TEventId) do
     first[e]:= true;
 
-{$I-} // iochecks off
-Assign(f, FileName);
-filemode:= 0; // readonly
-Reset(f);
-if IOResult = 0 then
-    loaded:= true;
-TryDo(loaded, 'Cannot load locale "' + FileName + '"', false);
-if loaded then
+f:= pfsOpenRead(FileName);
+TryDo(f <> nil, 'Cannot load locale "' + FileName + '"', false);
+
+if f <> nil then
     begin
-    while not eof(f) do
-    begin
-       readln(f, s);
+    while not pfsEof(f) do
+        begin
+        pfsReadLn(f, s);
         if Length(s) = 0 then
             continue;
         if (s[1] < '0') or (s[1] > '9') then
@@ -99,9 +95,8 @@
                 trgoal[TGoalStrId(b)]:= s;
            end;
        end;
-   Close(f);
+   pfsClose(f);
    end;
-{$I+}
 end;
 
 function GetEventString(e: TEventId): ansistring;