src/proto2/Network.hh
branchno-netsession
changeset 35 e21cfda0edde
parent 32 2ff929186c90
child 36 785d220fc6b7
--- a/src/proto2/Network.hh	Mon Nov 10 21:58:38 2008 +0000
+++ b/src/proto2/Network.hh	Tue Nov 18 22:58:50 2008 +0000
@@ -6,6 +6,8 @@
 
 #include <ClanLib/network.h>
 
+const int32_t COORDINATE_MAX = 1 << 30;
+
 class NetworkCore {
     protected:
         GameState &state;
@@ -14,24 +16,28 @@
 
         // constructor
         NetworkCore (GameState &state) : state(state) { }
+
+
 };
 
+// XXX: util methods
+void writeVector (CL_NetPacket &pkt, const Vector &vec);
+Vector readVector (CL_NetPacket &pkt);
+
 enum NetworkMessage {
     NETMSG_PACKET_INVALID   = 0x00,
 
     /*
      * You have joined the game:
      *
-     *  uint32_t x
-     *  uint32_t y
+     *  Vector      initial_position
      */
     NETMSG_SERVER_HELLO = 0x0100,
 
     /*
      * New client has connected to server:
-     *
-     *  uint32_t x
-     *  uint32_t y
+     *  
+     *  Vector      initial_position
      */
     NETMSG_PLAYER_JOIN  = 0x0101,
 
@@ -44,24 +50,23 @@
     /*
      * Client has moved
      *
-     *  int32_t dx
-     *  int32_t dy
+     *  Vector      impulse_force
+     *  uint16_t    impulse_ms
      */
     NETMSG_CLIENT_MOVE  = 0x0201,
     
     /*
      * Initial player info
      *
-     *  uint32_t x
-     *  uint32_t y
+     *  Vector      initial_position
      */
     NETMSG_PLAYER_INFO  = 0x0300,
 
     /*
      * Player position update
      *
-     *  uint32_t x
-     *  uint32_t y
+     * Vector   position
+     * Vector   velocity
      */
     NETMSG_PLAYER_POSITION  = 0x0301,
 };