hedgewars/uMisc.pas
changeset 2154 3d2917be12c3
parent 2152 a2811690da1b
child 2156 3f1a19802d10
equal deleted inserted replaced
2153:e41fdfaa8edd 2154:3d2917be12c3
   534 end;
   534 end;
   535 
   535 
   536 {$IFDEF DEBUGFILE}
   536 {$IFDEF DEBUGFILE}
   537 procedure AddFileLog(s: shortstring);
   537 procedure AddFileLog(s: shortstring);
   538 begin
   538 begin
       
   539 {$IFDEF IPHONEOS}
       
   540 //we are not able (and it is useless) to write a file on device, so we will print on the computer console instead
       
   541 f:=stderr;
       
   542 {$ENDIF}
   539 writeln(f, GameTicks: 6, ': ', s);
   543 writeln(f, GameTicks: 6, ': ', s);
   540 flush(f)
   544 flush(f)
   541 end;
   545 end;
   542 
   546 
   543 function RectToStr(Rect: TSDL_Rect): shortstring;
   547 function RectToStr(Rect: TSDL_Rect): shortstring;
   558 cVampiric:= false;
   562 cVampiric:= false;
   559 cArtillery:= false;
   563 cArtillery:= false;
   560 
   564 
   561 {$IFDEF DEBUGFILE}
   565 {$IFDEF DEBUGFILE}
   562 {$I-}
   566 {$I-}
   563 if ParamCount >= 0 then
   567 f:=stderr;
   564  //this check prevents a crash in Mac OS X
   568 rewrite(f);
   565  if ParamCount = 0 then
   569 {$IFNDEF IPHONEOS}
   566  begin
   570 if ParamCount <> 0 then
   567 	Assign(f, '/tmp/debug.txt');
   571    for i:= 0 to 7 do
   568     rewrite(f);
   572     begin 
   569  end else
   573 	  assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
   570  begin
   574       rewrite(f);
   571   for i:= 0 to 7 do
   575       if IOResult = 0 then break
   572     begin
       
   573     Assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
       
   574     rewrite(f);
       
   575     if IOResult = 0 then break
       
   576     end;
   576     end;
   577  end;
   577 {$ENDIF}
   578 {$I+}
   578 {$I+}
   579 
   579 
   580 finalization
   580 finalization
   581 //uRandom.DumpBuffer;
   581 //uRandom.DumpBuffer;
   582 writeln(f, '-= halt at ',GameTicks,' ticks =-');
   582 
   583 Flush(f);
   583 writeln(f, 'halt at ',GameTicks,' ticks');
       
   584 flush(f);
   584 close(f)
   585 close(f)
       
   586 
   585 {$ENDIF}
   587 {$ENDIF}
   586 
   588 
   587 end.
   589 end.