hedgewars/uLocale.pas
changeset 11532 bf86c6cb9341
parent 11200 08c6ccc28007
child 11544 b69f5f22a3ba
child 11684 cfc3971de8ac
--- a/hedgewars/uLocale.pas	Sun Jan 24 00:02:57 2016 +0100
+++ b/hedgewars/uLocale.pas	Sun Jan 31 16:07:14 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;