diff -r b8b91c7e0da8 -r 88929358d2e1 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Fri Jan 17 18:17:47 2014 +0100 +++ b/hedgewars/uVariables.pas Sat Jan 18 00:10:33 2014 +0400 @@ -2367,18 +2367,18 @@ cTestLua : Boolean; -var trammo: array[TAmmoStrId] of ansistring; // name of the weapon - trammoc: array[TAmmoStrId] of ansistring; // caption of the weapon - trammod: array[TAmmoStrId] of ansistring; // description of the weapon - trmsg: array[TMsgStrId] of ansistring; // message of the event - trgoal: array[TGoalStrId] of ansistring; // message of the goal +var trammo: array[TAmmoStrId] of PChar; // name of the weapon + trammoc: array[TAmmoStrId] of PChar; // caption of the weapon + trammod: array[TAmmoStrId] of PChar; // description of the weapon + trmsg: array[TMsgStrId] of PChar; // message of the event + trgoal: array[TGoalStrId] of PChar; // message of the goal procedure preInitModule; procedure initModule; procedure freeModule; implementation -uses strutils; +uses strutils, sysutils; procedure preInitModule; begin @@ -2423,7 +2423,21 @@ end; procedure initModule; +var asid: TAmmoStrId; + msid: TMsgStrId; + gsid: TGoalStrId; begin + for asid:= Low(TAmmoStrId) to High(TAmmoStrId) do + begin + trammo[asid]:= nil; + trammoc[asid]:= nil; + trammod[asid]:= nil; + end; + for msid:= Low(TMsgStrId) to High(TMsgStrId) do + trmsg[msid]:= nil; + for gsid:= Low(TGoalStrId) to High(TGoalStrId) do + trgoal[gsid]:= nil; + // TODO: we could just have one cLocale variables and drop strutils cLocale:= ExtractDelimited(1, cLocaleFName, StdWordDelims); @@ -2606,7 +2620,20 @@ end; procedure freeModule; +var asid: TAmmoStrId; + msid: TMsgStrId; + gsid: TGoalStrId; begin + for asid:= Low(TAmmoStrId) to High(TAmmoStrId) do + begin + if trammo[asid] <> nil then StrDispose(trammo[asid]); + if trammoc[asid] <> nil then StrDispose(trammoc[asid]); + if trammod[asid] <> nil then StrDispose(trammod[asid]); + end; + for msid:= Low(TMsgStrId) to High(TMsgStrId) do + if trmsg[msid] <> nil then StrDispose(trmsg[msid]); + for gsid:= Low(TGoalStrId) to High(TGoalStrId) do + if trgoal[gsid] <> nil then StrDispose(trgoal[gsid]); end; end.