src/proto2/NetworkClient.hh
changeset 22 b70d30e1b0fe
parent 21 32c6cc55256a
child 23 8d802b573cf0
equal deleted inserted replaced
21:32c6cc55256a 22:b70d30e1b0fe
     2 #define NETWORKCLIENT_HH
     2 #define NETWORKCLIENT_HH
     3 
     3 
     4 #include "Network.hh"
     4 #include "Network.hh"
     5 #include "GameState.hh"
     5 #include "GameState.hh"
     6 
     6 
       
     7 // forward-declare
       
     8 class NetworkClientRemotePlayer;
       
     9 
     7 class NetworkClient : public NetworkCore {
    10 class NetworkClient : public NetworkCore {
     8 	private:
    11 	private:
     9 		CL_NetComputer server;
    12 		CL_NetComputer server;
       
    13 		
       
    14 	public:
       
    15 		NetworkClient (GameState &state, const CL_IPAddress &connect_to);
       
    16 
       
    17 	private:
       
    18 		void on_create_object (CL_NetObject_Client &obj, int msg_type, CL_NetPacket &pkt);
       
    19 
       
    20 		void on_server_hello (CL_NetObject_Client &obj, CL_NetPacket &pkt);
       
    21 		void on_player_info (CL_NetObject_Client &obj, CL_NetPacket &pkt);
       
    22 		void on_player_join (CL_NetObject_Client &obj, CL_NetPacket &pkt);
       
    23 	
       
    24 	public:
       
    25 		void player_quit (NetworkClientRemotePlayer *player);
       
    26 };
       
    27 
       
    28 class NetworkClientLocalPlayer : public LocalPlayer {
       
    29 	private:
       
    30 		NetworkClient &client;
       
    31 
       
    32 		CL_SlotContainer slots;
       
    33 
       
    34 		CL_NetObject_Client &obj;
    10 
    35 
    11 	public:
    36 	public:
    12 		NetworkClient (GameState &state, const CL_IPAddress &connect_to);
    37 		NetworkClientLocalPlayer (NetworkClient &client, CL_NetObject_Client &obj, Coordinate initial_position);
       
    38 		
       
    39 		virtual void move (PositionDelta d);
       
    40 	
       
    41 	private:
       
    42 		void on_position (CL_NetPacket &pkt);
       
    43 };
       
    44 
       
    45 class NetworkClientRemotePlayer : public RemotePlayer {
       
    46 	private:
       
    47 		NetworkClient &client;
       
    48 		
       
    49 		CL_SlotContainer slots;
       
    50 
       
    51 		CL_NetObject_Client &obj;
       
    52 
       
    53 	public:
       
    54 		NetworkClientRemotePlayer (NetworkClient &client, CL_NetObject_Client &obj, Coordinate initial_position);
       
    55 	
       
    56 	private:
       
    57 		void on_position (CL_NetPacket &pkt);
       
    58 
       
    59 		void on_quit (CL_NetPacket &pkt);
    13 };
    60 };
    14 
    61 
    15 #endif
    62 #endif