author | sheepluva |
Tue, 10 Nov 2015 20:43:13 +0100 | |
branch | sdl2transition |
changeset 11342 | ed5a6478e710 |
parent 9682 | aa2431ed87b2 |
parent 11046 | 47a8c19ecb60 |
child 11408 | b894922d58cc |
child 11512 | bd9a2f1b0080 |
permissions | -rw-r--r-- |
4976 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
11046 | 3 |
* Copyright (c) 2004-2015 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 |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4976 | 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; |
|
9682 | 27 |
procedure SDLTry(Assert: boolean; Msg: shortstring; isFatal: boolean); |
4403 | 28 |
|
29 |
implementation |
|
10306 | 30 |
uses SDLh, uConsole, uCommands, uConsts; |
4403 | 31 |
|
32 |
procedure OutError(Msg: shortstring; isFatalError: boolean); |
|
33 |
begin |
|
34 |
WriteLnToConsole(Msg); |
|
35 |
if isFatalError then |
|
10306 | 36 |
begin |
8437 | 37 |
ParseCommand('fatal ' + lastConsoleline, true); |
10306 | 38 |
// hint for the 'coverity' source analyzer |
39 |
// this halt is never actually reached because ParseCommands will halt first |
|
40 |
halt(HaltFatalError); |
|
41 |
end; |
|
4403 | 42 |
end; |
43 |
||
44 |
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); |
|
45 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
4976
diff
changeset
|
46 |
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
|
47 |
OutError(Msg, isFatal) |
4403 | 48 |
end; |
49 |
||
9682 | 50 |
procedure SDLTry(Assert: boolean; Msg: shortstring; isFatal: boolean); |
7134 | 51 |
var s: shortstring; |
4403 | 52 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
4976
diff
changeset
|
53 |
if not Assert then |
7134 | 54 |
begin |
55 |
s:= SDL_GetError(); |
|
9682 | 56 |
OutError(Msg + ': ' + s, isFatal) |
7134 | 57 |
end |
4403 | 58 |
end; |
59 |
||
4900 | 60 |
end. |