Get rid of cripple SendIPCc
authorunc0rr
Sat, 12 May 2012 22:50:33 +0400
changeset 7068 b1b7eb9c8cc9
parent 7067 f98ec3aecf4e
child 7069 bcf9d8e64e92
Get rid of cripple SendIPCc
hedgewars/GSHandlers.inc
hedgewars/uCommandHandlers.pas
hedgewars/uGears.pas
hedgewars/uIO.pas
--- a/hedgewars/GSHandlers.inc	Sat May 12 22:44:39 2012 +0400
+++ b/hedgewars/GSHandlers.inc	Sat May 12 22:50:33 2012 +0400
@@ -1156,8 +1156,8 @@
             end;
         if Gear^.Timer = 0 then
             begin
-            SendIPCc('N');
-            SendIPCc('q');
+            SendIPC(_S'N');
+            SendIPC(_S'q');
             GameState := gsExit
             end
     end;
--- a/hedgewars/uCommandHandlers.pas	Sat May 12 22:44:39 2012 +0400
+++ b/hedgewars/uCommandHandlers.pas	Sat May 12 22:50:33 2012 +0400
@@ -71,7 +71,7 @@
     s:= s; // avoid compiler hint
     if GameState = gsConfirm then
     begin
-        SendIPCc('Q');
+        SendIPC(_S'Q');
         GameState:= gsExit
     end
 else
@@ -81,7 +81,7 @@
 procedure chHalt (var s: shortstring);
 begin
     s:= s; // avoid compiler hint
-    SendIPCc('H');
+    SendIPC(_S'H');
     GameState:= gsExit
 end;
 
@@ -218,7 +218,7 @@
 if CheckNoTeamOrHH or isPaused then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('L');
+    SendIPC(_S'L');
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     Message:= Message or (gmLeft and InputMask);
@@ -231,7 +231,7 @@
 if CheckNoTeamOrHH then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('l');
+    SendIPC(_S'l');
 with CurrentHedgehog^.Gear^ do
     Message:= Message and (not (gmLeft and InputMask));
     ScriptCall('onLeftUp');
@@ -243,7 +243,7 @@
 if CheckNoTeamOrHH or isPaused then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('R');
+    SendIPC(_S'R');
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     Message:= Message or (gmRight and InputMask);
@@ -256,7 +256,7 @@
 if CheckNoTeamOrHH then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('r');
+    SendIPC(_S'r');
 with CurrentHedgehog^.Gear^ do
     Message:= Message and (not (gmRight and InputMask));
     ScriptCall('onRightUp');
@@ -268,7 +268,7 @@
 if CheckNoTeamOrHH or isPaused then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('U');
+    SendIPC(_S'U');
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     Message:= Message or (gmUp and InputMask);
@@ -281,7 +281,7 @@
 if CheckNoTeamOrHH then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('u');
+    SendIPC(_S'u');
 with CurrentHedgehog^.Gear^ do
     Message:= Message and (not (gmUp and InputMask));
     ScriptCall('onUpUp');
@@ -293,7 +293,7 @@
 if CheckNoTeamOrHH or isPaused then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('D');
+    SendIPC(_S'D');
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     Message:= Message or (gmDown and InputMask);
@@ -306,7 +306,7 @@
 if CheckNoTeamOrHH then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('d');
+    SendIPC(_S'd');
 with CurrentHedgehog^.Gear^ do
     Message:= Message and (not (gmDown and InputMask));
     ScriptCall('onDownUp');
@@ -318,7 +318,7 @@
 if CheckNoTeamOrHH or isPaused then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('Z');
+    SendIPC(_S'Z');
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     Message:= Message or (gmPrecise and InputMask);
@@ -331,7 +331,7 @@
 if CheckNoTeamOrHH then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('z');
+    SendIPC(_S'z');
 with CurrentHedgehog^.Gear^ do
     Message:= Message and (not (gmPrecise and InputMask));
     ScriptCall('onPreciseUp');
@@ -343,7 +343,7 @@
 if CheckNoTeamOrHH or isPaused then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('j');
+    SendIPC(_S'j');
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     Message:= Message or (gmLJump and InputMask);
@@ -356,7 +356,7 @@
 if CheckNoTeamOrHH or isPaused then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('J');
+    SendIPC(_S'J');
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     Message:= Message or (gmHJump and InputMask);
@@ -376,7 +376,7 @@
         begin
         FollowGear:= CurrentHedgehog^.Gear;
         if not CurrentTeam^.ExtDriven then
-            SendIPCc('A');
+            SendIPC(_S'A');
         Message:= Message or (gmAttack and InputMask);
         ScriptCall('onAttack');
         end
@@ -392,7 +392,7 @@
     begin
     if not CurrentTeam^.ExtDriven and
         ((Message and gmAttack) <> 0) then
-            SendIPCc('a');
+            SendIPC(_S'a');
     Message:= Message and (not (gmAttack and InputMask));
     ScriptCall('onAttackUp');
     end
@@ -404,7 +404,7 @@
 if CheckNoTeamOrHH or isPaused then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc('S');
+    SendIPC(_S'S');
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     Message:= Message or (gmSwitch and InputMask);
@@ -417,7 +417,7 @@
     TryDo(AllInactive, '/nextturn called when not all gears are inactive', true);
 
     if not CurrentTeam^.ExtDriven then
-        SendIPCc('N');
+        SendIPC(_S'N');
     AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));
 end;
 
@@ -439,6 +439,7 @@
 
 procedure chSlot(var s: shortstring);
 var slot: LongWord;
+    ss: shortstring;
 begin
 if (s[0] <> #1) or CheckNoTeamOrHH then
     exit;
@@ -446,7 +447,11 @@
 if slot > cMaxSlotIndex then
     exit;
 if not CurrentTeam^.ExtDriven then
-    SendIPCc(char(byte(s[1]) + 79));
+    begin
+    ss[0]:= #1;
+    ss[1]:= char(byte(s[1]) + 79);
+    SendIPC(ss);
+    end;
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     begin
--- a/hedgewars/uGears.pas	Sat May 12 22:44:39 2012 +0400
+++ b/hedgewars/uGears.pas	Sat May 12 22:50:33 2012 +0400
@@ -446,7 +446,7 @@
     begin
     if (not CurrentTeam^.ExtDriven) then
         begin
-        SendIPCc('#');
+        SendIPC(_S'#');
         AddFileLog('hiTicks increment message sent')
         end;
 
@@ -1161,7 +1161,7 @@
 begin
 s:= s; // avoid compiler hint
 if not CurrentTeam^.ExtDriven then
-    SendIPCc(',');
+    SendIPC(_S',');
 uStats.Skipped;
 skipFlag:= true
 end;
--- a/hedgewars/uIO.pas	Sat May 12 22:44:39 2012 +0400
+++ b/hedgewars/uIO.pas	Sat May 12 22:50:33 2012 +0400
@@ -27,7 +27,6 @@
 
 procedure InitIPC;
 procedure SendIPC(s: shortstring);
-procedure SendIPCc(c: char);
 procedure SendIPCXY(cmd: char; X, Y: SmallInt);
 procedure SendIPCRaw(p: pointer; len: Longword);
 procedure SendIPCAndWaitReply(s: shortstring);
@@ -117,7 +116,7 @@
 begin
 case s[1] of
      '!': begin AddFileLog('Ping? Pong!'); isPonged:= true; end;
-     '?': SendIPCc('!');
+     '?': SendIPC(_S'!');
      'e': ParseCommand(copy(s, 2, Length(s) - 1), true);
      'E': OutError(copy(s, 2, Length(s) - 1), true);
      'W': OutError(copy(s, 2, Length(s) - 1), false);
@@ -222,14 +221,6 @@
     end
 end;
 
-procedure SendIPCc(c: char);
-var s: shortstring;
-begin
-    s[0]:= #1;
-    s[1]:= c;
-    SendIPC(s);
-end;
-
 procedure SendIPCRaw(p: pointer; len: Longword);
 begin
 if IPCSock <> nil then
@@ -260,7 +251,7 @@
 procedure SendIPCAndWaitReply(s: shortstring);
 begin
 SendIPC(s);
-SendIPCc('?');
+SendIPC(_S'?');
 IPCWaitPongEvent
 end;
 
@@ -268,7 +259,7 @@
 begin
 inc(SendEmptyPacketTicks, Lag);
 if (SendEmptyPacketTicks >= cSendEmptyPacketTime) then
-    SendIPCc('+')
+    SendIPC(_S'+')
 end;
 
 procedure NetGetNextCmd;