src/proto2/Network.hh
changeset 21 32c6cc55256a
parent 15 7710cce889b2
child 22 b70d30e1b0fe
equal deleted inserted replaced
20:f6dc5967c49c 21:32c6cc55256a
     1 #ifndef NETWORK_HH
     1 #ifndef NETWORK_HH
     2 #define NETWORK_HH
     2 #define NETWORK_HH
     3 
     3 
       
     4 #include "NetworkConfig.hh"
       
     5 #include "GameState.hh"
       
     6 
     4 #include <ClanLib/network.h>
     7 #include <ClanLib/network.h>
     5 
     8 
     6 #include "NetworkConfig.hh"
     9 class NetworkCore {
       
    10 	protected:
       
    11 		GameState &state;
     7 
    12 
     8 class NetworkBase {
    13 		CL_SlotContainer slots;
     9 	protected:
       
    10 		CL_Socket socket;
       
    11 
    14 
    12 		NetworkBase () : 
    15 		CL_NetSession netsession;
    13 				socket(CL_Socket::udp)
    16 		
    14 		{
    17 		// constructor
    15 				socket.set_nonblocking(true);
    18 		NetworkCore (GameState &state) : state(state), netsession(NETWORK_APP_NAME) { }
    16 		}
       
    17 
       
    18 		NetworkBase (CL_Socket socket) :
       
    19 				socket(socket)
       
    20 		{
       
    21 				socket.set_nonblocking(true);
       
    22 		}
       
    23 };
    19 };
    24 
    20 
    25 #endif
    21 #endif