hedgewars/uLocale.pas
changeset 3926 668b71f31e51
parent 3774 af0e68ca273e
child 3963 6090d2a2472e
equal deleted inserted replaced
3924:2a9ace189288 3926:668b71f31e51
    44             gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery,
    44             gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery,
    45             gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, gidRandomMineTimer,
    45             gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, gidRandomMineTimer,
    46             gidDamageModifier);
    46             gidDamageModifier);
    47 
    47 
    48 const MAX_EVENT_STRINGS = 100;
    48 const MAX_EVENT_STRINGS = 100;
    49 var trammo: array[TAmmoStrId] of ansistring;
    49 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
    50     trammoc: array[TAmmoStrId] of ansistring;
    50     trammoc: array[TAmmoStrId] of ansistring;   // caption of the weapon
    51     trammod: array[TAmmoStrId] of ansistring;
    51     trammod: array[TAmmoStrId] of ansistring;   // description of the weapon
    52     trmsg: array[TMsgStrId] of ansistring;
    52     trmsg:   array[TMsgStrId]  of ansistring;   // message of the event
    53     trgoal: array[TGoalStrId] of ansistring;
    53     trgoal:  array[TGoalStrId] of ansistring;   // message of the goal
    54 
    54 
    55 procedure LoadLocale(FileName: shortstring);
    55 procedure LoadLocale(FileName: shortstring);
    56 function Format(fmt: shortstring; var arg: shortstring): shortstring;
    56 function  Format(fmt: shortstring; var arg: shortstring): shortstring;
    57 function Format(fmt: ansistring; var arg: ansistring): ansistring;
    57 function  Format(fmt: ansistring; var arg: ansistring): ansistring;
    58 
    58 function  GetEventString(e: TEventId): ansistring;
    59 function GetEventString(e: TEventId): ansistring;
       
    60 
    59 
    61 implementation
    60 implementation
    62 uses uMisc, uRandom;
    61 uses uMisc, uRandom;
    63 
    62 
    64 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
    63 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
   142 i:= Pos('%1', fmt);
   141 i:= Pos('%1', fmt);
   143 if i = 0 then Format:= fmt
   142 if i = 0 then Format:= fmt
   144          else Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
   143          else Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
   145 end;
   144 end;
   146 
   145 
       
   146 procedure LoadLocaleWrapper(str: pchar); cdecl; export;
       
   147 begin
       
   148     LoadLocale(Strpas(str));
       
   149 end;
       
   150 
   147 end.
   151 end.