#ifndef NETWORKCLIENT_HH
#define NETWORKCLIENT_HH
#include "Network.hh"
#include "GameState.hh"
// forward-declare
class NetworkClientLocalPlayer;
class NetworkClientRemotePlayer;
class NetworkClient : public NetworkCore {
friend class NetworkClientLocalPlayer;
friend class NetworkClientRemotePlayer;
private:
CL_NetComputer server;
public:
NetworkClient (GameState &state, const CL_IPAddress &connect_to);
private:
void on_create_object (CL_NetObject_Client &obj, int msg_type, CL_NetPacket &pkt);
void on_server_hello (CL_NetObject_Client &obj, CL_NetPacket &pkt);
void on_player_info (CL_NetObject_Client &obj, CL_NetPacket &pkt);
void on_player_join (CL_NetObject_Client &obj, CL_NetPacket &pkt);
public:
void player_quit (NetworkClientRemotePlayer *player);
};
class NetworkClientLocalPlayer : public LocalPlayer {
private:
NetworkClient &client;
CL_SlotContainer slots;
CL_NetObject_Client obj;
public:
NetworkClientLocalPlayer (NetworkClient &client, CL_NetObject_Client &obj, Coordinate initial_position);
virtual bool move (PositionDelta d);
private:
void on_position (CL_NetPacket &pkt);
};
class NetworkClientRemotePlayer : public RemotePlayer {
private:
NetworkClient &client;
CL_SlotContainer slots;
CL_NetObject_Client obj;
public:
NetworkClientRemotePlayer (NetworkClient &client, CL_NetObject_Client &obj, Coordinate initial_position);
private:
void on_position (CL_NetPacket &pkt);
void on_quit (CL_NetPacket &pkt);
};
#endif