Move SendStats to uIO
authorunC0Rr
Thu, 18 Nov 2010 11:50:02 +0300
changeset 4376 9654205a9424
parent 4375 ae5507ddb989
child 4377 43945842da0c
Move SendStats to uIO
hedgewars/hwengine.pas
hedgewars/uIO.pas
hedgewars/uMisc.pas
hedgewars/uStats.pas
hedgewars/uTeams.pas
--- a/hedgewars/hwengine.pas	Thu Nov 18 11:45:31 2010 +0300
+++ b/hedgewars/hwengine.pas	Thu Nov 18 11:50:02 2010 +0300
@@ -125,7 +125,6 @@
     FreeActionsList();
     StoreRelease();
     ControllerClose();
-    SendKB();
     CloseIPC();
     TTF_Quit();
 {$IFDEF SDL13}
--- a/hedgewars/uIO.pas	Thu Nov 18 11:45:31 2010 +0300
+++ b/hedgewars/uIO.pas	Thu Nov 18 11:50:02 2010 +0300
@@ -20,7 +20,7 @@
 
 unit uIO;
 interface
-uses SDLh;
+uses SDLh, uTypes;
 
 var ipcPort: Word = 0;
     hiTicks: Word;
@@ -35,6 +35,7 @@
 procedure SendIPCTimeInc;
 procedure SendKeepAliveMessage(Lag: Longword);
 procedure LoadRecordFromFile(fileName: shortstring);
+procedure SendStat(sit: TStatInfoType; s: shortstring);
 procedure IPCWaitPongEvent;
 procedure IPCCheckSock;
 procedure InitIPC;
@@ -42,7 +43,7 @@
 procedure NetGetNextCmd;
 
 implementation
-uses uConsole, uConsts, uMisc, uLand, uChat, uTeams, uTypes, uVariables, uCommands, uUtils;
+uses uConsole, uConsts, uMisc, uLand, uChat, uTeams, uVariables, uCommands, uUtils;
 
 type PCmd = ^TCmd;
      TCmd = packed record
@@ -203,6 +204,14 @@
 close(f)
 end;
 
+procedure SendStat(sit: TStatInfoType; s: shortstring);
+const stc: array [TStatInfoType] of char = 'rDkKHTPsSB';
+var buf: shortstring;
+begin
+buf:= 'i' + stc[sit] + s;
+SendIPCRaw(@buf[0], length(buf) + 1)
+end;
+
 procedure SendIPC(s: shortstring);
 begin
 if IPCSock <> nil then
--- a/hedgewars/uMisc.pas	Thu Nov 18 11:45:31 2010 +0300
+++ b/hedgewars/uMisc.pas	Thu Nov 18 11:50:02 2010 +0300
@@ -25,12 +25,6 @@
 
 
 procedure movecursor(dx, dy: LongInt);
-(*
-procedure AdjustColor(var Color: Longword);
-procedure SetKB(n: Longword);
-*)
-procedure SendKB;
-procedure SendStat(sit: TStatInfoType; s: shortstring);
 function  doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface;
 procedure OutError(Msg: shortstring; isFatalError: boolean);
 procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline;
@@ -41,10 +35,7 @@
 procedure freeModule;
 
 implementation
-uses uConsole, uIO, typinfo, sysutils, uVariables, uUtils;
-
-var KBnum: Longword;
-
+uses uConsole, uIO, typinfo, sysutils, uVariables;
 
 procedure movecursor(dx, dy: LongInt);
 var x, y: LongInt;
@@ -81,38 +72,6 @@
 if not Assert then OutError(SDL_GetError, isFatal)
 end;
 
-(*
-procedure AdjustColor(var Color: Longword);
-begin
-Color:= SDL_MapRGB(PixelFormat, (Color shr 16) and $FF, (Color shr 8) and $FF, Color and $FF)
-end;
-
-procedure SetKB(n: Longword);
-begin
-KBnum:= n
-end;
-*)
-
-
-procedure SendKB;
-var s: shortstring;
-begin
-if KBnum <> 0 then
-begin
-s:= 'K' + inttostr(KBnum);
-SendIPCRaw(@s, Length(s) + 1)
-end
-end;
-
-procedure SendStat(sit: TStatInfoType; s: shortstring);
-const stc: array [TStatInfoType] of char = 'rDkKHTPsSB';
-var buf: shortstring;
-begin
-buf:= 'i' + stc[sit] + s;
-SendIPCRaw(@buf[0], length(buf) + 1)
-end;
-
-
 procedure MakeScreenshot(filename: shortstring);
 var p: Pointer;
     size: Longword;
@@ -200,7 +159,6 @@
 
 procedure initModule;
 begin
-    KBnum           := 0;
 end;
 
 procedure freeModule;
--- a/hedgewars/uStats.pas	Thu Nov 18 11:45:31 2010 +0300
+++ b/hedgewars/uStats.pas	Thu Nov 18 11:50:02 2010 +0300
@@ -35,7 +35,7 @@
 procedure SendStats;
 
 implementation
-uses uTeams, uSound, uMisc, uLocale, uWorld, uVariables, uUtils;
+uses uTeams, uSound, uMisc, uLocale, uWorld, uVariables, uUtils, uIO;
 
 var DamageGiven : Longword = 0;
     DamageClan  : Longword = 0;
--- a/hedgewars/uTeams.pas	Thu Nov 18 11:45:31 2010 +0300
+++ b/hedgewars/uTeams.pas	Thu Nov 18 11:50:02 2010 +0300
@@ -37,7 +37,7 @@
 function  GetTeamStatString(p: PTeam): shortstring;
 
 implementation
-uses uMisc, uWorld, uLocale, uAmmos, uChat, uMobile, uVariables, uUtils;
+uses uMisc, uWorld, uLocale, uAmmos, uChat, uMobile, uVariables, uUtils, uIO;
 const MaxTeamHealth: LongInt = 0;
 
 function CheckForWin: boolean;