hedgewars/uVariables.pas
changeset 10009 88929358d2e1
parent 9998 736015b847e3
child 10015 4feced261c68
equal deleted inserted replaced
10008:b8b91c7e0da8 10009:88929358d2e1
  2365 
  2365 
  2366     lastTurnChecksum : Longword;
  2366     lastTurnChecksum : Longword;
  2367 
  2367 
  2368     cTestLua : Boolean;
  2368     cTestLua : Boolean;
  2369 
  2369 
  2370 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
  2370 var trammo:  array[TAmmoStrId] of PChar;   // name of the weapon
  2371     trammoc: array[TAmmoStrId] of ansistring;   // caption of the weapon
  2371     trammoc: array[TAmmoStrId] of PChar;   // caption of the weapon
  2372     trammod: array[TAmmoStrId] of ansistring;   // description of the weapon
  2372     trammod: array[TAmmoStrId] of PChar;   // description of the weapon
  2373     trmsg:   array[TMsgStrId]  of ansistring;   // message of the event
  2373     trmsg:   array[TMsgStrId]  of PChar;   // message of the event
  2374     trgoal:  array[TGoalStrId] of ansistring;   // message of the goal
  2374     trgoal:  array[TGoalStrId] of PChar;   // message of the goal
  2375 
  2375 
  2376 procedure preInitModule;
  2376 procedure preInitModule;
  2377 procedure initModule;
  2377 procedure initModule;
  2378 procedure freeModule;
  2378 procedure freeModule;
  2379 
  2379 
  2380 implementation
  2380 implementation
  2381 uses strutils;
  2381 uses strutils, sysutils;
  2382 
  2382 
  2383 procedure preInitModule;
  2383 procedure preInitModule;
  2384 begin
  2384 begin
  2385     // initialisation flags - they are going to be overwritten by program args
  2385     // initialisation flags - they are going to be overwritten by program args
  2386 
  2386 
  2421     cAudioCodec        := '';
  2421     cAudioCodec        := '';
  2422 {$ENDIF}
  2422 {$ENDIF}
  2423 end;
  2423 end;
  2424 
  2424 
  2425 procedure initModule;
  2425 procedure initModule;
       
  2426 var asid: TAmmoStrId;
       
  2427     msid: TMsgStrId;
       
  2428     gsid: TGoalStrId;
  2426 begin
  2429 begin
       
  2430     for asid:= Low(TAmmoStrId) to High(TAmmoStrId) do
       
  2431         begin
       
  2432         trammo[asid]:= nil;
       
  2433         trammoc[asid]:= nil;
       
  2434         trammod[asid]:= nil;
       
  2435         end;
       
  2436     for msid:= Low(TMsgStrId) to High(TMsgStrId) do
       
  2437         trmsg[msid]:= nil;
       
  2438     for gsid:= Low(TGoalStrId) to High(TGoalStrId) do
       
  2439         trgoal[gsid]:= nil;
       
  2440         
  2427     // TODO: we could just have one cLocale variables and drop strutils
  2441     // TODO: we could just have one cLocale variables and drop strutils
  2428     cLocale:= ExtractDelimited(1, cLocaleFName, StdWordDelims);
  2442     cLocale:= ExtractDelimited(1, cLocaleFName, StdWordDelims);
  2429 
  2443 
  2430     cFlattenFlakes      := false;
  2444     cFlattenFlakes      := false;
  2431     cFlattenClouds      := false;
  2445     cFlattenClouds      := false;
  2604     UIDisplay:= uiAll;
  2618     UIDisplay:= uiAll;
  2605     LocalMessage:= 0;
  2619     LocalMessage:= 0;
  2606 end;
  2620 end;
  2607 
  2621 
  2608 procedure freeModule;
  2622 procedure freeModule;
       
  2623 var asid: TAmmoStrId;
       
  2624     msid: TMsgStrId;
       
  2625     gsid: TGoalStrId;
  2609 begin
  2626 begin
       
  2627     for asid:= Low(TAmmoStrId) to High(TAmmoStrId) do
       
  2628         begin
       
  2629         if trammo[asid] <> nil then StrDispose(trammo[asid]);
       
  2630         if trammoc[asid] <> nil then StrDispose(trammoc[asid]);
       
  2631         if trammod[asid] <> nil then StrDispose(trammod[asid]);
       
  2632         end;
       
  2633     for msid:= Low(TMsgStrId) to High(TMsgStrId) do
       
  2634         if trmsg[msid] <> nil then StrDispose(trmsg[msid]);
       
  2635     for gsid:= Low(TGoalStrId) to High(TGoalStrId) do
       
  2636         if trgoal[gsid] <> nil then StrDispose(trgoal[gsid]);
  2610 end;
  2637 end;
  2611 
  2638 
  2612 end.
  2639 end.