hedgewars/uDebug.pas
changeset 11507 bd9a2f1b0080
parent 11362 ed5a6478e710
child 11532 bf86c6cb9341
--- a/hedgewars/uDebug.pas	Wed Jan 13 16:19:50 2016 +0100
+++ b/hedgewars/uDebug.pas	Sun Jan 10 00:45:13 2016 +0300
@@ -24,7 +24,10 @@
 
 procedure OutError(Msg: shortstring; isFatalError: boolean);
 procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline;
-procedure SDLTry(Assert: boolean; Msg: shortstring; isFatal: boolean);
+function SDLCheck(Assert: boolean; Msg: shortstring; isFatal: boolean): boolean;
+
+var
+    allOK: boolean;
 
 implementation
 uses SDLh, uConsole, uCommands, uConsts;
@@ -47,14 +50,17 @@
     OutError(Msg, isFatal)
 end;
 
-procedure SDLTry(Assert: boolean; Msg: shortstring; isFatal: boolean);
+function SDLCheck(Assert: boolean; Msg: shortstring; isFatal: boolean): boolean;
 var s: shortstring;
 begin
-if not Assert then
+    if not Assert then
     begin
-    s:= SDL_GetError();
-    OutError(Msg + ': ' + s, isFatal)
-    end
+        s:= SDL_GetError();
+        OutError(Msg + ': ' + s, false)
+    end;
+
+    allOK:= allOK and (Assert or (not isFatal));
+    SDLCheck:= (not Assert) and isFatal
 end;
 
 end.