diff -r 54a78ec6aac4 -r 0dfe26f48ec1 hedgewars/uDebug.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uDebug.pas Sun Nov 21 19:41:19 2010 +0300 @@ -0,0 +1,35 @@ +{$INCLUDE "options.inc"} + +unit uDebug; + +interface + +procedure OutError(Msg: shortstring; isFatalError: boolean); +procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline; +procedure SDLTry(Assert: boolean; isFatal: boolean); + +implementation +uses SDLh, uConsole, uCommands; + +procedure OutError(Msg: shortstring; isFatalError: boolean); +begin +WriteLnToConsole(Msg); +if isFatalError then + begin + ParseCommand('fatal ' + GetLastConsoleLine, true); + SDL_Quit; + halt(1) + end +end; + +procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); +begin +if not Assert then OutError(Msg, isFatal) +end; + +procedure SDLTry(Assert: boolean; isFatal: boolean); +begin +if not Assert then OutError(SDL_GetError, isFatal) +end; + +end. \ No newline at end of file