src/proto2/NetworkClient.hh
author terom
Sun, 09 Nov 2008 20:40:46 +0000
changeset 24 b81cb670e6b2
parent 23 8d802b573cf0
child 25 af75a1894a32
permissions -rw-r--r--
the great :retab
#ifndef NETWORKCLIENT_HH
#define NETWORKCLIENT_HH

#include "Network.hh"
#include "GameState.hh"

// forward-declare
class NetworkClientRemotePlayer;

class NetworkClient : public NetworkCore {
    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 void 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