equal
deleted
inserted
replaced
|
1 {$INCLUDE "options.inc"} |
|
2 |
|
3 unit uDebug; |
|
4 |
|
5 interface |
|
6 |
|
7 procedure OutError(Msg: shortstring; isFatalError: boolean); |
|
8 procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline; |
|
9 procedure SDLTry(Assert: boolean; isFatal: boolean); |
|
10 |
|
11 implementation |
|
12 uses SDLh, uConsole, uCommands; |
|
13 |
|
14 procedure OutError(Msg: shortstring; isFatalError: boolean); |
|
15 begin |
|
16 WriteLnToConsole(Msg); |
|
17 if isFatalError then |
|
18 begin |
|
19 ParseCommand('fatal ' + GetLastConsoleLine, true); |
|
20 SDL_Quit; |
|
21 halt(1) |
|
22 end |
|
23 end; |
|
24 |
|
25 procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); |
|
26 begin |
|
27 if not Assert then OutError(Msg, isFatal) |
|
28 end; |
|
29 |
|
30 procedure SDLTry(Assert: boolean; isFatal: boolean); |
|
31 begin |
|
32 if not Assert then OutError(SDL_GetError, isFatal) |
|
33 end; |
|
34 |
|
35 end. |