hedgewars/uMisc.pas
changeset 53 0e27949850e3
parent 47 8daf1ee0b9a3
child 55 e09f7c952a40
equal deleted inserted replaced
52:ae2950c5465c 53:0e27949850e3
   134 end;
   134 end;
   135 
   135 
   136 procedure OutError(Msg: String; const isFatalError: boolean=false);
   136 procedure OutError(Msg: String; const isFatalError: boolean=false);
   137 begin
   137 begin
   138 {$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF}
   138 {$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF}
       
   139 WriteLnToConsole(Msg);
   139 if isFatalError then
   140 if isFatalError then
   140    begin
   141    begin
   141    SendIPC('E' + Msg);
   142    SendIPC('E' + GetLastConsoleLine);
   142    WriteLn(Msg);
       
   143    SDL_Quit;
   143    SDL_Quit;
   144 //   Readln;
       
   145    halt(1)
   144    halt(1)
   146    end else WriteLnToConsole(Msg)
   145    end
   147 end;
   146 end;
   148 
   147 
   149 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
   148 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
   150 begin
   149 begin
   151 if not Assert then OutError(msg, isFatal)
   150 if not Assert then OutError(msg, isFatal)
   166 str(n, Result)
   165 str(n, Result)
   167 end;
   166 end;
   168 
   167 
   169 function FloatToStr(n: real): shortstring;
   168 function FloatToStr(n: real): shortstring;
   170 begin
   169 begin
   171 str(n, Result)
   170 str(n:5:5, Result)
   172 end;
   171 end;
   173 
   172 
   174 function arctan(const Y, X: real): real;
   173 function arctan(const Y, X: real): real;
   175 asm
   174 asm
   176         fld     Y
   175         fld     Y