hedgewars/uDebug.pas
author unc0rr
Thu, 19 Apr 2012 23:36:20 +0400
changeset 6893 69cc0166be8d
parent 6700 e04da46ee43c
child 7134 beb16926ae5c
permissions -rw-r--r--
- Track array size to use for High function - Some fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
     1
(*
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6700
e04da46ee43c the most important commit of the year
koda
parents: 6580
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
     4
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
     8
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
    12
 * GNU General Public License for more details.
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
    13
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
    14
 * You should have received a copy of the GNU General Public License
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
    15
 * along with this program; if not, write to the Free Software
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
    17
 *)
088d40d8aba2 Happy 2011 :)
koda
parents: 4900
diff changeset
    18
4403
unc0rr
parents:
diff changeset
    19
{$INCLUDE "options.inc"}
unc0rr
parents:
diff changeset
    20
unc0rr
parents:
diff changeset
    21
unit uDebug;
unc0rr
parents:
diff changeset
    22
unc0rr
parents:
diff changeset
    23
interface
unc0rr
parents:
diff changeset
    24
unc0rr
parents:
diff changeset
    25
procedure OutError(Msg: shortstring; isFatalError: boolean);
unc0rr
parents:
diff changeset
    26
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline;
unc0rr
parents:
diff changeset
    27
procedure SDLTry(Assert: boolean; isFatal: boolean);
unc0rr
parents:
diff changeset
    28
unc0rr
parents:
diff changeset
    29
implementation
unc0rr
parents:
diff changeset
    30
uses SDLh, uConsole, uCommands;
unc0rr
parents:
diff changeset
    31
unc0rr
parents:
diff changeset
    32
procedure OutError(Msg: shortstring; isFatalError: boolean);
unc0rr
parents:
diff changeset
    33
begin
unc0rr
parents:
diff changeset
    34
WriteLnToConsole(Msg);
unc0rr
parents:
diff changeset
    35
if isFatalError then
unc0rr
parents:
diff changeset
    36
    begin
unc0rr
parents:
diff changeset
    37
    ParseCommand('fatal ' + GetLastConsoleLine, true);
unc0rr
parents:
diff changeset
    38
    SDL_Quit;
unc0rr
parents:
diff changeset
    39
    halt(1)
unc0rr
parents:
diff changeset
    40
    end
unc0rr
parents:
diff changeset
    41
end;
unc0rr
parents:
diff changeset
    42
unc0rr
parents:
diff changeset
    43
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean);
unc0rr
parents:
diff changeset
    44
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 4976
diff changeset
    45
if not Assert then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 4976
diff changeset
    46
    OutError(Msg, isFatal)
4403
unc0rr
parents:
diff changeset
    47
end;
unc0rr
parents:
diff changeset
    48
unc0rr
parents:
diff changeset
    49
procedure SDLTry(Assert: boolean; isFatal: boolean);
unc0rr
parents:
diff changeset
    50
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 4976
diff changeset
    51
if not Assert then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 4976
diff changeset
    52
    OutError(SDL_GetError, isFatal)
4403
unc0rr
parents:
diff changeset
    53
end;
unc0rr
parents:
diff changeset
    54
4900
8ad0e23e6d63 addfilelog <3 debugfile
koda
parents: 4403
diff changeset
    55
end.