hedgewars/uDebug.pas
author sheepluva
Sun, 30 Jan 2011 06:56:12 +0100
changeset 4884 b2006a9f0fbc
parent 4403 0dfe26f48ec1
child 4900 8ad0e23e6d63
permissions -rw-r--r--
nicklists: * friends go to the top * ignored people go to the bottom * first time each of those happens it automatically scrolls there (to avoid "where did it go?!"-moments) friendslist/ignorelist: adding a nick to one will remove it from other

{$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.