hedgewars/uLocale.pas
changeset 2721 87067dcc208b
parent 2717 2b75ef82676d
child 2722 d891285e500f
--- a/hedgewars/uLocale.pas	Wed Jan 27 19:58:52 2010 +0000
+++ b/hedgewars/uLocale.pas	Thu Jan 28 19:01:57 2010 +0000
@@ -67,38 +67,35 @@
 Assign(f, FileName);
 reset(f);
 TryDo(IOResult = 0, 'Cannot load locale "' + FileName + '"', false);
-if (IOResult <> 0) then
-   begin
-   while not eof(f) do
-       begin
-       readln(f, s);
-       if Length(s) = 0 then continue;
-       if not (s[1] in ['0'..'9']) then continue;
-       TryDo(Length(s) > 6, 'Load locale: empty string', true);
-       val(s[1]+s[2], a, c);
-       TryDo(c = 0, 'Load locale: numbers should be two-digit: ' + s, true);
-       TryDo(s[3] = ':', 'Load locale: ":" expected', true);
-       val(s[4]+s[5], b, c);
-       TryDo(c = 0, 'Load locale: numbers should be two-digit' + s, true);
-       TryDo(s[6] = '=', 'Load locale: "=" expected', true);
-       Delete(s, 1, 6);
-       case a of
-           0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammo[TAmmoStrId(b+1)]:= s;
-           1: if (b >=0) and (b <= ord(High(TMsgStrId))) then trmsg[TMsgStrId(b)]:= s;
-           2: if (b >=0) and (b <= ord(High(TEventId))) then begin
-               TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + inttostr(a) + ':' + inttostr(b), false);
-               if first[TEventId(b)] then
-                   begin
-                   trevt_n[TEventId(b)]:= 0;
-                   first[TEventId(b)]:= false;
-                   end;
-               trevt[TEventId(b)][trevt_n[TEventId(b)]]:= s;
-               inc(trevt_n[TEventId(b)]);
-               end;
-           end;
-       end;
-   Close(f)
-   end
+while not eof(f) do
+    begin
+    readln(f, s);
+    if Length(s) = 0 then continue;
+    if not (s[1] in ['0'..'9']) then continue;
+    TryDo(Length(s) > 6, 'Load locale: empty string', true);
+    val(s[1]+s[2], a, c);
+    TryDo(c = 0, 'Load locale: numbers should be two-digit: ' + s, true);
+    TryDo(s[3] = ':', 'Load locale: ":" expected', true);
+    val(s[4]+s[5], b, c);
+    TryDo(c = 0, 'Load locale: numbers should be two-digit' + s, true);
+    TryDo(s[6] = '=', 'Load locale: "=" expected', true);
+    Delete(s, 1, 6);
+    case a of
+        0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammo[TAmmoStrId(b+1)]:= s;
+        1: if (b >=0) and (b <= ord(High(TMsgStrId))) then trmsg[TMsgStrId(b)]:= s;
+        2: if (b >=0) and (b <= ord(High(TEventId))) then begin
+            TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + inttostr(a) + ':' + inttostr(b), false);
+            if first[TEventId(b)] then
+                begin
+                trevt_n[TEventId(b)]:= 0;
+                first[TEventId(b)]:= false;
+                end;
+            trevt[TEventId(b)][trevt_n[TEventId(b)]]:= s;
+            inc(trevt_n[TEventId(b)]);
+            end;
+        end;
+    end;
+Close(f)
 {$I+}
 end;