- Handle new command in game record and net
authorunc0rr
Tue, 05 Feb 2008 18:25:46 +0000
changeset 784 b203147d91b5
parent 783 4f59db6f147d
child 785 ac538f1a629e
- Handle new command in game record and net - Inc protocol version due to changes
CMakeLists.txt
hedgewars/CCHandlers.inc
hedgewars/uAmmos.pas
hedgewars/uIO.pas
--- a/CMakeLists.txt	Tue Feb 05 17:53:38 2008 +0000
+++ b/CMakeLists.txt	Tue Feb 05 18:25:46 2008 +0000
@@ -9,7 +9,7 @@
 endif(DEFINED DATA_INSTALL_DIR)
 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
 
-set(HEDGEWARS_PROTO_VER 8)
+set(HEDGEWARS_PROTO_VER 9)
 
 add_subdirectory(bin)
 add_subdirectory(QTfrontend)
--- a/hedgewars/CCHandlers.inc	Tue Feb 05 17:53:38 2008 +0000
+++ b/hedgewars/CCHandlers.inc	Tue Feb 05 18:25:46 2008 +0000
@@ -310,11 +310,15 @@
 procedure chSetWeapon(var s: shortstring);
 begin
 if (s[0] <> #1) or CheckNoTeamOrHH then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('w' + char(byte(s[1]) + 79));
+
+if TAmmoType(s[1]) > High(TAmmoType) then exit;
+
+if not CurrentTeam^.ExtDriven then SendIPC('w' + s);
+
 with CurrentHedgehog^.Gear^ do
      begin
      Message:= Message or gm_Weapon;
-     MsgParam:= byte(s[1]) - ord('a')
+     MsgParam:= byte(s[1])
      end
 end;
 
--- a/hedgewars/uAmmos.pas	Tue Feb 05 17:53:38 2008 +0000
+++ b/hedgewars/uAmmos.pas	Tue Feb 05 18:25:46 2008 +0000
@@ -217,7 +217,7 @@
 
 procedure SetWeapon(weap: TAmmoType);
 begin
-ParseCommand('/setweap ' + chr(ord('a') + byte(weap)), true)
+ParseCommand('/setweap ' + char(weap), true)
 end;
 
 end.
--- a/hedgewars/uIO.pas	Tue Feb 05 17:53:38 2008 +0000
+++ b/hedgewars/uIO.pas	Tue Feb 05 18:25:46 2008 +0000
@@ -258,6 +258,7 @@
              CursorPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X)) + WorldDx);
              CursorPoint.Y:= SmallInt(SDLNet_Read16(@(headcmd^.Y)) + WorldDy);
              end;
+        'w': ParseCommand('setweap ' + headcmd^.str[2], true);
         '1'..'5': ParseCommand('timer ' + headcmd^.cmd, true);
         #128..char(128 + cMaxSlotIndex): ParseCommand('slot ' + char(byte(headcmd^.cmd) - 79), true)
         end;