hedgewars/uLocale.pas
changeset 4374 bcefeeabaa33
parent 4361 64ea345ab655
child 4377 43945842da0c
equal deleted inserted replaced
4373:fe0e3903bb9e 4374:bcefeeabaa33
    33 function  Format(fmt: shortstring; var arg: shortstring): shortstring;
    33 function  Format(fmt: shortstring; var arg: shortstring): shortstring;
    34 function  Format(fmt: ansistring; var arg: ansistring): ansistring;
    34 function  Format(fmt: ansistring; var arg: ansistring): ansistring;
    35 function  GetEventString(e: TEventId): ansistring;
    35 function  GetEventString(e: TEventId): ansistring;
    36 
    36 
    37 implementation
    37 implementation
    38 uses uMisc, uRandom;
    38 uses uMisc, uRandom, uUtils;
    39 
    39 
    40 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
    40 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
    41     trevt_n: array[TEventId] of integer;
    41     trevt_n: array[TEventId] of integer;
    42 
    42 
    43 procedure LoadLocale(FileName: shortstring);
    43 procedure LoadLocale(FileName: shortstring);
    75        Delete(s, 1, 6);
    75        Delete(s, 1, 6);
    76        case a of
    76        case a of
    77            0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammo[TAmmoStrId(b+1)]:= s;
    77            0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammo[TAmmoStrId(b+1)]:= s;
    78            1: if (b >=0) and (b <= ord(High(TMsgStrId))) then trmsg[TMsgStrId(b)]:= s;
    78            1: if (b >=0) and (b <= ord(High(TMsgStrId))) then trmsg[TMsgStrId(b)]:= s;
    79            2: if (b >=0) and (b <= ord(High(TEventId))) then begin
    79            2: if (b >=0) and (b <= ord(High(TEventId))) then begin
    80                TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + inttostr(a) + ':' + inttostr(b), false);
    80                TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + IntToStr(a) + ':' + IntToStr(b), false);
    81                if first[TEventId(b)] then
    81                if first[TEventId(b)] then
    82                    begin
    82                    begin
    83                    trevt_n[TEventId(b)]:= 0;
    83                    trevt_n[TEventId(b)]:= 0;
    84                    first[TEventId(b)]:= false;
    84                    first[TEventId(b)]:= false;
    85                    end;
    85                    end;