hedgewars/uLocale.pas
changeset 2905 f3c79f7193a9
parent 2904 209a0c573917
child 2908 bd1909984a09
--- a/hedgewars/uLocale.pas	Mon Mar 01 19:20:43 2010 +0000
+++ b/hedgewars/uLocale.pas	Mon Mar 01 19:54:33 2010 +0000
@@ -40,27 +40,28 @@
 
 	TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable,
 			gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery,
-			gidSolidLand, gidSharedAmmo, gidMineTimer);
+			gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, gidRandomMineTimer);
 
 const MAX_EVENT_STRINGS = 100;
-var trammo: array[TAmmoStrId] of string;
-    trammoc: array[TAmmoStrId] of string;
-    trammod: array[TAmmoStrId] of string;
-    trmsg: array[TMsgStrId] of string;
-    trgoal: array[TGoalStrId] of string;
+var trammo: array[TAmmoStrId] of ansistring;
+    trammoc: array[TAmmoStrId] of ansistring;
+    trammod: array[TAmmoStrId] of ansistring;
+    trmsg: array[TMsgStrId] of ansistring;
+    trgoal: array[TGoalStrId] of ansistring;
 
-procedure LoadLocale(FileName: string);
+procedure LoadLocale(FileName: shortstring);
 function Format(fmt: shortstring; var arg: shortstring): shortstring;
+function Format(fmt: ansistring; var arg: ansistring): ansistring;
 
-function GetEventString(e: TEventId): string;
+function GetEventString(e: TEventId): ansistring;
 
 implementation
 uses uMisc, uRandom, uConsole;
 
-var	trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of string;
+var	trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
 	trevt_n: array[TEventId] of integer;
 
-procedure LoadLocale(FileName: string);
+procedure LoadLocale(FileName: shortstring);
 var s: shortstring;
     f: textfile;
     a, b, c: LongInt;
@@ -116,7 +117,7 @@
 {$I+}
 end;
 
-function GetEventString(e: TEventId): string;
+function GetEventString(e: TEventId): ansistring;
 begin
 	if trevt_n[e] = 0 then // no messages for this event type?
 		GetEventString:= '*missing translation*'
@@ -132,4 +133,12 @@
          else Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
 end;
 
+function Format(fmt: ansistring; var arg: ansistring): ansistring;
+var i: LongInt;
+begin
+i:= Pos('%1', fmt);
+if i = 0 then Format:= fmt
+         else Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
+end;
+
 end.