author | koda |
Thu, 26 Dec 2013 16:50:02 +0100 | |
branch | 0.9.19 |
changeset 9146 | 0aa5c1ce9e11 |
parent 9080 | 9b42757d7e71 |
child 9301 | c5d1c8259ef4 |
permissions | -rw-r--r-- |
4976 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
9080 | 3 |
* Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com> |
4976 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*) |
|
18 |
||
4403 | 19 |
{$INCLUDE "options.inc"} |
20 |
||
21 |
unit uDebug; |
|
22 |
||
23 |
interface |
|
24 |
||
25 |
procedure OutError(Msg: shortstring; isFatalError: boolean); |
|
26 |
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline; |
|
27 |
procedure SDLTry(Assert: boolean; isFatal: boolean); |
|
28 |
||
29 |
implementation |
|
30 |
uses SDLh, uConsole, uCommands; |
|
31 |
||
32 |
procedure OutError(Msg: shortstring; isFatalError: boolean); |
|
33 |
begin |
|
34 |
WriteLnToConsole(Msg); |
|
35 |
if isFatalError then |
|
36 |
begin |
|
8437 | 37 |
ParseCommand('fatal ' + lastConsoleline, true); |
4403 | 38 |
SDL_Quit; |
39 |
halt(1) |
|
40 |
end |
|
41 |
end; |
|
42 |
||
43 |
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); |
|
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 | 47 |
end; |
48 |
||
49 |
procedure SDLTry(Assert: boolean; isFatal: boolean); |
|
7134 | 50 |
var s: shortstring; |
4403 | 51 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
4976
diff
changeset
|
52 |
if not Assert then |
7134 | 53 |
begin |
54 |
s:= SDL_GetError(); |
|
55 |
OutError(s, isFatal) |
|
56 |
end |
|
4403 | 57 |
end; |
58 |
||
4900 | 59 |
end. |