hedgewars/uLocale.pas
changeset 2357 babe1a55e284
parent 2185 cf8f98e75bf9
child 2376 ece7b87f1334
equal deleted inserted replaced
2356:b756432fd422 2357:babe1a55e284
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  *)
    17  *)
    18 
    18 
    19 unit uLocale;
    19 unit uLocale;
    20 interface
    20 interface
    21 type TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidUFO, sidShotgun,
    21 type TAmmoStrId = (sidNothing, sidGrenade, sidClusterBomb, sidBazooka, sidUFO, sidShotgun,
    22 			sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
    22 			sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
    23 			sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds,
    23 			sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds,
    24 			sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch,
    24 			sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch,
    25 			sidGirder, sidTeleport, sidSwitch, sidMortar, sidWhip,
    25 			sidGirder, sidTeleport, sidSwitch, sidMortar, sidWhip,
    26 			sidKamikaze, sidCake, sidSeduction, sidWatermelon,
    26 			sidKamikaze, sidCake, sidSeduction, sidWatermelon,
    54     f: textfile;
    54     f: textfile;
    55     a, b, c: LongInt;
    55     a, b, c: LongInt;
    56 	first: array[TEventId] of boolean;
    56 	first: array[TEventId] of boolean;
    57 	e: TEventId;
    57 	e: TEventId;
    58 begin
    58 begin
    59 
    59 trammo[sidNothing]:= ' ';
    60 for e:= Low(TEventId) to High(TEventId) do first[e]:= true;
    60 for e:= Low(TEventId) to High(TEventId) do first[e]:= true;
    61 
    61 
    62 {$I-}
    62 {$I-}
    63 Assign(f, FileName);
    63 Assign(f, FileName);
    64 reset(f);
    64 reset(f);
    75 	val(s[4]+s[5], b, c);
    75 	val(s[4]+s[5], b, c);
    76 	TryDo(c = 0, 'Load locale: numbers should be two-digit' + s, true);
    76 	TryDo(c = 0, 'Load locale: numbers should be two-digit' + s, true);
    77 	TryDo(s[6] = '=', 'Load locale: "=" expected', true);
    77 	TryDo(s[6] = '=', 'Load locale: "=" expected', true);
    78 	Delete(s, 1, 6);
    78 	Delete(s, 1, 6);
    79 	case a of
    79 	case a of
    80 		0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammo[TAmmoStrId(b)]:= s;
    80 		0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammo[TAmmoStrId(b+1)]:= s;
    81 		1: if (b >=0) and (b <= ord(High(TMsgStrId))) then trmsg[TMsgStrId(b)]:= s;
    81 		1: if (b >=0) and (b <= ord(High(TMsgStrId))) then trmsg[TMsgStrId(b)]:= s;
    82 		2: if (b >=0) and (b <= ord(High(TEventId))) then begin
    82 		2: if (b >=0) and (b <= ord(High(TEventId))) then begin
    83 			TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + inttostr(a) + ':' + inttostr(b), false);
    83 			TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + inttostr(a) + ':' + inttostr(b), false);
    84 			if first[TEventId(b)] then
    84 			if first[TEventId(b)] then
    85 				begin
    85 				begin