hedgewars/uUtils.pas
changeset 7027 f264ad9d8965
parent 6990 40e5af28d026
child 7028 0f60591f3a16
equal deleted inserted replaced
7026:8d1724e1337e 7027:f264ad9d8965
    63 function  CheckNoTeamOrHH: boolean; inline;
    63 function  CheckNoTeamOrHH: boolean; inline;
    64 
    64 
    65 function  GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
    65 function  GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
    66 function  GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
    66 function  GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
    67 
    67 
    68 procedure initModule;
    68 procedure initModule(isGame: boolean);
    69 procedure freeModule;
    69 procedure freeModule;
    70 
    70 
    71 
    71 
    72 implementation
    72 implementation
    73 uses typinfo, Math, uConsts, uVariables, SysUtils;
    73 uses typinfo, Math, uConsts, uVariables, SysUtils;
   357 function CheckNoTeamOrHH: boolean;
   357 function CheckNoTeamOrHH: boolean;
   358 begin
   358 begin
   359 CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil);
   359 CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil);
   360 end;
   360 end;
   361 
   361 
   362 procedure initModule;
   362 procedure initModule(isGame: boolean);
   363 {$IFDEF DEBUGFILE}{$IFNDEF MOBILE}var i: LongInt;{$ENDIF}{$ENDIF}
       
   364 begin
       
   365 {$IFDEF DEBUGFILE}
   363 {$IFDEF DEBUGFILE}
       
   364 var logfileBase: shortstring;
       
   365 {$IFNDEF MOBILE}var i: LongInt;{$ENDIF}
       
   366 {$ENDIF}
       
   367 begin
       
   368 {$IFDEF DEBUGFILE}
       
   369     if isGame then
       
   370         logfileBase:= 'game'
       
   371     else
       
   372         logfileBase:= 'preview';
   366 {$I-}
   373 {$I-}
   367 {$IFDEF MOBILE}
   374 {$IFDEF MOBILE}
   368     {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + cLogfileBase + '.log'); {$ENDIF}
   375     {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF}
   369     {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + cLogfileBase + '.log'); {$ENDIF}
   376     {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF}
   370     Rewrite(f);
   377     Rewrite(f);
   371 {$ELSE}
   378 {$ELSE}
   372     if (UserPathPrefix <> '') then
   379     if (UserPathPrefix <> '') then
   373         begin
   380         begin
   374             i:= 0;
   381             i:= 0;
   375             while(i < 7) do
   382             while(i < 7) do
   376             begin
   383             begin
   377                 assign(f, UserPathPrefix + '/Logs/' + cLogfileBase + inttostr(i) + '.log');
   384                 assign(f, UserPathPrefix + '/Logs/' + logfileBase + inttostr(i) + '.log');
   378                 rewrite(f);
   385                 rewrite(f);
   379                 if IOResult = 0 then
   386                 if IOResult = 0 then
   380                     break;
   387                     break;
   381                 inc(i)
   388                 inc(i)
   382             end;
   389             end;