hedgewars/uMisc.pas
changeset 337 a46abb65eb0c
parent 316 57d50189ad86
child 346 fc1e0a4f152c
equal deleted inserted replaced
336:82d654db133d 337:a46abb65eb0c
   206 procedure SetLittle(var r: Double);
   206 procedure SetLittle(var r: Double);
   207 begin
   207 begin
   208 if r >= 0 then r:= cLittle else r:= - cLittle 
   208 if r >= 0 then r:= cLittle else r:= - cLittle 
   209 end;
   209 end;
   210 
   210 
       
   211 procedure SendStat(sit: TStatInfoType; s: shortstring);
       
   212 const stc: array [TStatInfoType] of char = 'rDK';
       
   213 begin
       
   214 SendIPC('i' + stc[sit] + s)
       
   215 end;
       
   216 
   211 {$IFDEF DEBUGFILE}
   217 {$IFDEF DEBUGFILE}
   212 procedure AddFileLog(s: shortstring);
   218 procedure AddFileLog(s: shortstring);
   213 begin
   219 begin
   214 writeln(f, GameTicks: 6, ': ', s);
   220 writeln(f, GameTicks: 6, ': ', s);
   215 flush(f)
   221 flush(f)
   218 function RectToStr(Rect: TSDL_Rect): shortstring;
   224 function RectToStr(Rect: TSDL_Rect): shortstring;
   219 begin
   225 begin
   220 Result:= '(x: ' + inttostr(rect.x) + '; y: ' + inttostr(rect.y) + '; w: ' + inttostr(rect.w) + '; h: ' + inttostr(rect.h) + ')'
   226 Result:= '(x: ' + inttostr(rect.x) + '; y: ' + inttostr(rect.y) + '; w: ' + inttostr(rect.w) + '; h: ' + inttostr(rect.h) + ')'
   221 end;
   227 end;
   222 
   228 
   223 procedure SendStat(sit: TStatInfoType; s: shortstring);
   229 
   224 const stc: array [TStatInfoType] of char = 'rDK';
   230 var i: integer;
   225 begin
       
   226 SendIPC('i' + stc[sit] + s)
       
   227 end;
       
   228 
   231 
   229 initialization
   232 initialization
   230 AssignFile(f, 'debug.txt');
   233 {$I-}
   231 rewrite(f);
   234 for i:= 0 to 7 do
       
   235     begin
       
   236     AssignFile(f, 'debug' + inttostr(i) + '.txt');
       
   237     rewrite(f);
       
   238     if IOResult = 0 then break
       
   239     end;
       
   240 {$I+}
   232 
   241 
   233 finalization
   242 finalization
   234 writeln(f, '-= halt at ',GameTicks,' ticks =-');
   243 writeln(f, '-= halt at ',GameTicks,' ticks =-');
   235 Flush(f);
   244 Flush(f);
   236 closefile(f)
   245 closefile(f)