hedgewars/uLocale.pas
branchqmlfrontend
changeset 11544 b69f5f22a3ba
parent 11403 b894922d58cc
parent 11532 bf86c6cb9341
child 11699 83c40c1eb0e7
--- a/hedgewars/uLocale.pas	Fri Jan 01 19:15:32 2016 +0300
+++ b/hedgewars/uLocale.pas	Tue Feb 09 21:11:16 2016 +0300
@@ -50,7 +50,7 @@
     first[e]:= true;
 
 f:= pfsOpenRead(FileName);
-TryDo(f <> nil, 'Cannot load locale "' + FileName + '"', false);
+checkFails(f <> nil, 'Cannot load locale "' + FileName + '"', false);
 
 s:= '';
 
@@ -63,18 +63,19 @@
             continue;
         if (s[1] < '0') or (s[1] > '9') then
             continue;
-        TryDo(Length(s) > 6, 'Load locale: empty string', true);
+        checkFails(Length(s) > 6, 'Load locale: empty string', true);
         {$IFNDEF PAS2C}
         val(s[1]+s[2], a, c);
-        TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
+        checkFails(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
         val(s[4]+s[5], b, c);
-        TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
+        checkFails(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
         {$ELSE}
         val(s[1]+s[2], a);
         val(s[4]+s[5], b);
         {$ENDIF}
-        TryDo(s[3] = ':', 'Load locale: ":" expected', true);
-        TryDo(s[6] = '=', 'Load locale: "=" expected', true);
+        checkFails(s[3] = ':', 'Load locale: ":" expected', true);
+        checkFails(s[6] = '=', 'Load locale: "=" expected', true);
+        if not allOK then exit;
         Delete(s, 1, 6);
         case a of
             0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then
@@ -83,7 +84,7 @@
                 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);
+                checkFails(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;