Haven't found a better place than uIO for OutError
authorunC0Rr
Thu, 18 Nov 2010 12:12:51 +0300
changeset 4377 43945842da0c
parent 4376 9654205a9424
child 4378 91655618a510
Haven't found a better place than uIO for OutError
hedgewars/uAI.pas
hedgewars/uAIActions.pas
hedgewars/uAIMisc.pas
hedgewars/uAmmos.pas
hedgewars/uCollisions.pas
hedgewars/uCommands.pas
hedgewars/uGears.pas
hedgewars/uIO.pas
hedgewars/uKeys.pas
hedgewars/uLand.pas
hedgewars/uLandGraphics.pas
hedgewars/uLandObjects.pas
hedgewars/uLandTexture.pas
hedgewars/uLocale.pas
hedgewars/uMisc.pas
hedgewars/uScript.pas
hedgewars/uSound.pas
hedgewars/uStats.pas
hedgewars/uStore.pas
hedgewars/uTeams.pas
hedgewars/uTextures.pas
--- a/hedgewars/uAI.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uAI.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -29,9 +29,9 @@
 procedure FreeActionsList;
 
 implementation
-uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions, uMisc,
+uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions,
      uAmmos, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes,
-     uVariables, uCommands, uUtils;
+     uVariables, uCommands, uUtils, uIO;
 
 var BestActions: TActions;
     CanUseAmmo: array [TAmmoType] of boolean;
--- a/hedgewars/uAIActions.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uAIActions.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -62,7 +62,7 @@
 procedure ProcessAction(var Actions: TActions; Me: PGear);
 
 implementation
-uses uMisc, uAIMisc, uAI, uAmmos, uVariables, uCommands, uUtils;
+uses uAIMisc, uAI, uAmmos, uVariables, uCommands, uUtils, uIO;
 
 const ActionIdToStr: array[0..6] of string[16] = (
 {aia_none}           '',
--- a/hedgewars/uAIMisc.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uAIMisc.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -68,8 +68,7 @@
              end;
 
 implementation
-uses uMisc, uCollisions, uVariables, uUtils;
-
+uses uCollisions, uVariables, uUtils, uIO;
 
 const KillScore = 200;
 
--- a/hedgewars/uAmmos.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uAmmos.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -47,7 +47,7 @@
 var StoreCnt: Longword;
 
 implementation
-uses uMisc, uWorld, uLocale, uMobile, uVariables, uCommands, uUtils;
+uses uWorld, uLocale, uMobile, uVariables, uCommands, uUtils, uIO;
 
 type TAmmoCounts = array[TAmmoType] of Longword;
 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
--- a/hedgewars/uCollisions.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uCollisions.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -52,7 +52,7 @@
 function  calcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): Boolean;
 
 implementation
-uses uMisc, uConsts, uLandGraphics, uVariables;
+uses uConsts, uLandGraphics, uVariables, uIO;
 
 type TCollisionEntry = record
             X, Y, Radius: LongInt;
--- a/hedgewars/uCommands.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uCommands.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -17,7 +17,7 @@
 implementation
 uses uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uMobile,
      uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript, uTypes,
-     uVariables, uConsole, uFloat, uMisc, uUtils;
+     uVariables, uConsole, uFloat, uUtils;
 
 type  PVariable = ^TVariable;
       TVariable = record
--- a/hedgewars/uGears.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uGears.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -45,7 +45,7 @@
 function  GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
 
 implementation
-uses uWorld, uMisc, uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
+uses uWorld, uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
      uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
      uCommands, uUtils, uTextures;
 
--- a/hedgewars/uIO.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uIO.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -28,6 +28,10 @@
 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);
@@ -43,7 +47,7 @@
 procedure NetGetNextCmd;
 
 implementation
-uses uConsole, uConsts, uMisc, uLand, uChat, uTeams, uVariables, uCommands, uUtils;
+uses uConsole, uConsts, uLand, uChat, uTeams, uVariables, uCommands, uUtils;
 
 type PCmd = ^TCmd;
      TCmd = packed record
@@ -66,6 +70,27 @@
     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
@@ -212,6 +237,7 @@
 SendIPCRaw(@buf[0], length(buf) + 1)
 end;
 
+
 procedure SendIPC(s: shortstring);
 begin
 if IPCSock <> nil then
--- a/hedgewars/uKeys.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uKeys.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -82,8 +82,7 @@
 {$ENDIF}
 {$ENDIF}
 implementation
-uses uConsole, uCommands, uMisc, uVariables, uConsts, uUtils;
-//const KeyNumber = 1024;
+uses uConsole, uCommands, uMisc, uVariables, uConsts, uUtils, uIO;
 
 var tkbd, tkbdn: TKeyboardState;
     KeyNames: array [0..cKeyMaxIndex] of string[15];
--- a/hedgewars/uLand.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uLand.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -35,7 +35,7 @@
 procedure CheckLandDigest(s: shortstring);
 
 implementation
-uses uConsole, uStore, uMisc, uRandom, uLandObjects, Adler32, uIO, uLandTexture, sysutils,
+uses uConsole, uStore, uRandom, uLandObjects, Adler32, uIO, uLandTexture, sysutils,
      uVariables, uUtils;
 
 operator=(const a, b: direction) c: Boolean;
--- a/hedgewars/uLandGraphics.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uLandGraphics.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -30,7 +30,7 @@
 function  SweepDirty: boolean;
 function  Despeckle(X, Y: LongInt): boolean;
 function  CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean;
-function DrawExplosion(X, Y, Radius: LongInt): Longword;
+function  DrawExplosion(X, Y, Radius: LongInt): Longword;
 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword);
@@ -40,7 +40,7 @@
 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean;
 
 implementation
-uses SDLh, uMisc, uLandTexture, uVariables, uUtils;
+uses SDLh, uLandTexture, uVariables, uUtils, uIO;
 
 procedure FillCircleLines(x, y, dx, dy: LongInt; Value: Longword);
 var i: LongInt;
--- a/hedgewars/uLandObjects.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uLandObjects.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -30,7 +30,7 @@
 
 implementation
 uses uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uSound, GLunit,
-     uTypes, uVariables, uUtils;
+     uTypes, uVariables, uUtils, uIO;
 
 const MaxRects = 512;
       MAXOBJECTRECTS = 16;
--- a/hedgewars/uLandTexture.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uLandTexture.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -28,7 +28,7 @@
 procedure DrawLand(dX, dY: LongInt);
 
 implementation
-uses uMisc, uStore, uConsts, GLunit, uTypes, uVariables, uTextures;
+uses uMisc, uStore, uConsts, GLunit, uTypes, uVariables, uTextures, uIO;
 
 const TEXSIZE = 256;
 
--- a/hedgewars/uLocale.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uLocale.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -35,7 +35,7 @@
 function  GetEventString(e: TEventId): ansistring;
 
 implementation
-uses uMisc, uRandom, uUtils;
+uses uRandom, uUtils, uIO;
 
 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
     trevt_n: array[TEventId] of integer;
--- a/hedgewars/uMisc.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uMisc.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -26,16 +26,13 @@
 
 procedure movecursor(dx, dy: LongInt);
 function  doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface;
-procedure OutError(Msg: shortstring; isFatalError: boolean);
-procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline;
-procedure SDLTry(Assert: boolean; isFatal: boolean);
 procedure MakeScreenshot(filename: shortstring);
 
 procedure initModule;
 procedure freeModule;
 
 implementation
-uses uConsole, uIO, typinfo, sysutils, uVariables;
+uses typinfo, sysutils, uVariables;
 
 procedure movecursor(dx, dy: LongInt);
 var x, y: LongInt;
@@ -49,29 +46,6 @@
 end;
 
 
-procedure OutError(Msg: shortstring; isFatalError: boolean);
-begin
-// obsolete? written in WriteLnToConsole() anyway
-// {$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF}
-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;
-
 procedure MakeScreenshot(filename: shortstring);
 var p: Pointer;
     size: Longword;
--- a/hedgewars/uScript.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uScript.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -41,7 +41,6 @@
 {$IFNDEF LUA_DISABLED}
 uses LuaPas in 'LuaPas.pas',
     uConsole,
-    uMisc,
     uConsts,
     uVisualGears,
     uGears,
@@ -55,7 +54,8 @@
     uTypes,
     uVariables,
     uCommands,
-    uUtils;
+    uUtils,
+    uIO;
 
 var luaState : Plua_State;
     ScriptAmmoLoadout : shortstring;
--- a/hedgewars/uSound.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uSound.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -46,7 +46,7 @@
 
 
 implementation
-uses uMisc, uVariables, uConsole, uUtils;
+uses uMisc, uVariables, uConsole, uUtils, uIO;
 
 const chanTPU = 32;
 var Volume: LongInt;
--- a/hedgewars/uStats.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uStats.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -35,7 +35,7 @@
 procedure SendStats;
 
 implementation
-uses uTeams, uSound, uMisc, uLocale, uWorld, uVariables, uUtils, uIO;
+uses uTeams, uSound, uLocale, uWorld, uVariables, uUtils, uIO;
 
 var DamageGiven : Longword = 0;
     DamageClan  : Longword = 0;
--- a/hedgewars/uStore.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uStore.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -66,7 +66,7 @@
 procedure Tint(c: Longword); inline;
 
 implementation
-uses uMisc, uConsole, uLocale, uMobile, uVariables, uUtils, uTextures;
+uses uMisc, uConsole, uLocale, uMobile, uVariables, uUtils, uTextures, uIO;
 
 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
 
--- a/hedgewars/uTeams.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uTeams.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -37,7 +37,8 @@
 function  GetTeamStatString(p: PTeam): shortstring;
 
 implementation
-uses uMisc, uWorld, uLocale, uAmmos, uChat, uMobile, uVariables, uUtils, uIO;
+uses uWorld, uLocale, uAmmos, uChat, uMobile, uVariables, uUtils, uIO;
+
 const MaxTeamHealth: LongInt = 0;
 
 function CheckForWin: boolean;
--- a/hedgewars/uTextures.pas	Thu Nov 18 11:50:02 2010 +0300
+++ b/hedgewars/uTextures.pas	Thu Nov 18 12:12:51 2010 +0300
@@ -12,7 +12,7 @@
 procedure freeModule;
 
 implementation
-uses GLunit, uUtils, uVariables, uConsts, uMisc;
+uses GLunit, uUtils, uVariables, uConsts, uMisc, uIO;
 
 var TextureList: PTexture;