hedgewars/uLocale.pas
changeset 4807 180dbfb13903
parent 4403 0dfe26f48ec1
child 4976 088d40d8aba2
equal deleted inserted replaced
4806:48c1a395f0a7 4807:180dbfb13903
    42     first: array[TEventId] of boolean;
    42     first: array[TEventId] of boolean;
    43     e: TEventId;
    43     e: TEventId;
    44     loaded: boolean;
    44     loaded: boolean;
    45 begin
    45 begin
    46 loaded:= false;
    46 loaded:= false;
    47 trammo[sidNothing]:= ' ';
       
    48 for e:= Low(TEventId) to High(TEventId) do first[e]:= true;
    47 for e:= Low(TEventId) to High(TEventId) do first[e]:= true;
    49 
    48 
    50 {$I-} // iochecks off
    49 {$I-} // iochecks off
    51 Assign(f, FileName);
    50 Assign(f, FileName);
    52 filemode:= 0; // readonly
    51 filemode:= 0; // readonly
    67        val(s[4]+s[5], b, c);
    66        val(s[4]+s[5], b, c);
    68        TryDo(c = 0, 'Load locale: numbers should be two-digit' + s, true);
    67        TryDo(c = 0, 'Load locale: numbers should be two-digit' + s, true);
    69        TryDo(s[6] = '=', 'Load locale: "=" expected', true);
    68        TryDo(s[6] = '=', 'Load locale: "=" expected', true);
    70        Delete(s, 1, 6);
    69        Delete(s, 1, 6);
    71        case a of
    70        case a of
    72            0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammo[TAmmoStrId(b+1)]:= s;
    71            0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammo[TAmmoStrId(b)]:= s;
    73            1: if (b >=0) and (b <= ord(High(TMsgStrId))) then trmsg[TMsgStrId(b)]:= s;
    72            1: if (b >=0) and (b <= ord(High(TMsgStrId))) then trmsg[TMsgStrId(b)]:= s;
    74            2: if (b >=0) and (b <= ord(High(TEventId))) then begin
    73            2: if (b >=0) and (b <= ord(High(TEventId))) then begin
    75                TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + IntToStr(a) + ':' + IntToStr(b), false);
    74                TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + IntToStr(a) + ':' + IntToStr(b), false);
    76                if first[TEventId(b)] then
    75                if first[TEventId(b)] then
    77                    begin
    76                    begin
    79                    first[TEventId(b)]:= false;
    78                    first[TEventId(b)]:= false;
    80                    end;
    79                    end;
    81                trevt[TEventId(b)][trevt_n[TEventId(b)]]:= s;
    80                trevt[TEventId(b)][trevt_n[TEventId(b)]]:= s;
    82                inc(trevt_n[TEventId(b)]);
    81                inc(trevt_n[TEventId(b)]);
    83                end;
    82                end;
    84            3: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammoc[TAmmoStrId(b+1)]:= s;
    83            3: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammoc[TAmmoStrId(b)]:= s;
    85            4: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammod[TAmmoStrId(b+1)]:= s;
    84            4: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammod[TAmmoStrId(b)]:= s;
    86            5: if (b >=0) and (b <= ord(High(TGoalStrId))) then trgoal[TGoalStrId(b)]:= s;
    85            5: if (b >=0) and (b <= ord(High(TGoalStrId))) then trgoal[TGoalStrId(b)]:= s;
    87            end;
    86            end;
    88        end;
    87        end;
    89    Close(f)
    88    Close(f)
    90    end;
    89    end;