hedgewars/uIO.pas
changeset 4403 0dfe26f48ec1
parent 4389 d1c65b60cd68
child 4404 6bae4e9461aa
--- a/hedgewars/uIO.pas	Sun Nov 21 19:14:45 2010 +0300
+++ b/hedgewars/uIO.pas	Sun Nov 21 19:41:19 2010 +0300
@@ -28,10 +28,6 @@
 procedure initModule;
 procedure freeModule;
 
-procedure OutError(Msg: shortstring; isFatalError: boolean);
-procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline;
-procedure SDLTry(Assert: boolean; isFatal: boolean);
-
 procedure SendIPC(s: shortstring);
 procedure SendIPCXY(cmd: char; X, Y: SmallInt);
 procedure SendIPCRaw(p: pointer; len: Longword);
@@ -47,7 +43,7 @@
 procedure NetGetNextCmd;
 
 implementation
-uses uConsole, uConsts, uChat, uTeams, uVariables, uCommands, uUtils;
+uses uConsole, uConsts, uChat, uTeams, uVariables, uCommands, uUtils, uDebug;
 
 type PCmd = ^TCmd;
      TCmd = packed record
@@ -69,28 +65,6 @@
 
     SendEmptyPacketTicks: LongWord;
 
-
-procedure OutError(Msg: shortstring; isFatalError: boolean);
-begin
-WriteLnToConsole(Msg);
-if isFatalError then
-    begin
-    SendIPC('E' + GetLastConsoleLine);
-    SDL_Quit;
-    halt(1)
-    end
-end;
-
-procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean);
-begin
-if not Assert then OutError(Msg, isFatal)
-end;
-
-procedure SDLTry(Assert: boolean; isFatal: boolean);
-begin
-if not Assert then OutError(SDL_GetError, isFatal)
-end;
-
 function AddCmd(Time: Word; str: shortstring): PCmd;
 var command: PCmd;
 begin
@@ -386,8 +360,15 @@
 if isInLag then fastUntilLag:= false
 end;
 
+procedure chFatalError(var s: shortstring);
+begin
+    SendIPC('E' + s);
+end;
+
 procedure initModule;
 begin
+    RegisterVariable('fatal', vtCommand, @chFatalError, true );
+
     IPCSock:= nil;
 
     headcmd:= nil;