hedgewars/uLocale.pas
changeset 10127 7f29a65aa1e4
parent 10123 64e72781d344
child 10249 b47ac2c19de3
equal deleted inserted replaced
10126:2fa3bb7785ee 10127:7f29a65aa1e4
    38 
    38 
    39 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
    39 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
    40     trevt_n: array[TEventId] of integer;
    40     trevt_n: array[TEventId] of integer;
    41 
    41 
    42 procedure LoadLocale(FileName: shortstring);
    42 procedure LoadLocale(FileName: shortstring);
    43 var s: ansistring = '';
    43 var s: ansistring;
    44     f: pfsFile;
    44     f: pfsFile;
    45     a, b, c: LongInt;
    45     a, b, c: LongInt;
    46     first: array[TEventId] of boolean;
    46     first: array[TEventId] of boolean;
    47     e: TEventId;
    47     e: TEventId;
    48 begin
    48 begin
    60         if Length(s) = 0 then
    60         if Length(s) = 0 then
    61             continue;
    61             continue;
    62         if (s[1] < '0') or (s[1] > '9') then
    62         if (s[1] < '0') or (s[1] > '9') then
    63             continue;
    63             continue;
    64         TryDo(Length(s) > 6, 'Load locale: empty string', true);
    64         TryDo(Length(s) > 6, 'Load locale: empty string', true);
       
    65         {$IFNDEF PAS2C}
    65         val(s[1]+s[2], a, c);
    66         val(s[1]+s[2], a, c);
    66         TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
    67         TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
    67         TryDo(s[3] = ':', 'Load locale: ":" expected', true);
       
    68         val(s[4]+s[5], b, c);
    68         val(s[4]+s[5], b, c);
    69         TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
    69         TryDo(c = 0, ansistring('Load locale: numbers should be two-digit: ') + s, true);
       
    70         {$ELSE}
       
    71         val(s[1]+s[2], a);
       
    72         val(s[4]+s[5], b);
       
    73         {$ENDIF}
       
    74         TryDo(s[3] = ':', 'Load locale: ":" expected', true);
    70         TryDo(s[6] = '=', 'Load locale: "=" expected', true);
    75         TryDo(s[6] = '=', 'Load locale: "=" expected', true);
    71         Delete(s, 1, 6);
    76         Delete(s, 1, 6);
    72         case a of
    77         case a of
    73             0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then
    78             0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then
    74                 trammo[TAmmoStrId(b)]:= s;
    79                 trammo[TAmmoStrId(b)]:= s;