hedgewars/uUtils.pas
branchhedgeroid
changeset 5661 45618bdce725
parent 5639 ebe9858eb6a3
child 5932 5164d17b6374
equal deleted inserted replaced
5659:20eb5765a5d0 5661:45618bdce725
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uUtils;
    21 unit uUtils;
    22 
    22 
    23 interface
    23 interface
    24 uses uTypes, uFloat, GLunit, uConsole;
    24 uses uTypes, uFloat, GLunit;
    25 
    25 
    26 procedure SplitBySpace(var a, b: shortstring);
    26 procedure SplitBySpace(var a, b: shortstring);
    27 procedure SplitByChar(var a, b: ansistring; c: char);
    27 procedure SplitByChar(var a, b: ansistring; c: char);
    28 
    28 
    29 function  EnumToStr(const en : TGearType) : shortstring; overload;
    29 function  EnumToStr(const en : TGearType) : shortstring; overload;
   260 
   260 
   261 procedure AddFileLog(s: shortstring);
   261 procedure AddFileLog(s: shortstring);
   262 begin
   262 begin
   263 s:= s;
   263 s:= s;
   264 {$IFDEF DEBUGFILE}
   264 {$IFDEF DEBUGFILE}
   265 {$IFDEF ANDROID}
       
   266  WriteToConsole(s);
       
   267 {$ELSE}
       
   268 writeln(f, GameTicks: 6, ': ', s);
   265 writeln(f, GameTicks: 6, ': ', s);
   269 flush(f)
   266 flush(f)
   270 {$ENDIF}
       
   271 {$ENDIF}
   267 {$ENDIF}
   272 end;
   268 end;
   273 
   269 
   274 
   270 
   275 function CheckCJKFont(s: ansistring; font: THWFont): THWFont;
   271 function CheckCJKFont(s: ansistring; font: THWFont): THWFont;
   335 begin
   331 begin
   336 CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil);
   332 CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil);
   337 end;
   333 end;
   338 
   334 
   339 procedure initModule;
   335 procedure initModule;
   340 {$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF}
   336 {$IFDEF DEBUGFILE}{$IFNDEF MOBILE}var i: LongInt;{$ENDIF}{$ENDIF}
   341 begin
   337 begin
   342 {$IFDEF DEBUGFILE}
   338 {$IFDEF DEBUGFILE}
   343 {$I-}
   339 {$I-}
   344 {$IFDEF IPHONEOS}
   340 {$IFDEF MOBILE}
   345     Assign(f,'../Documents/hw-' + cLogfileBase + '.log');
   341     {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + cLogfileBase + '.log'); {$ENDIF}
       
   342     {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + cLogfileBase + '.log'); {$ENDIF}
   346     Rewrite(f);
   343     Rewrite(f);
   347 {$ELSE}
   344 {$ELSE}
   348     if (ParamStr(1) <> '') and (ParamStr(2) <> '') then
   345     if (ParamStr(1) <> '') and (ParamStr(2) <> '') then
   349         if (ParamCount <> 3) and (ParamCount <> cDefaultParamNum) then
   346         if (ParamCount <> 3) and (ParamCount <> cDefaultParamNum) then
   350         begin
   347         begin