#ifndef PLAYER_H #define PLAYER_H #include #include #include #include #include #include "connection.h" class Player : public boost::enable_shared_from_this { public: typedef boost::shared_ptr p; static p create(Connection::p c, boost::function f); private: Connection::p connection; boost::asio::deadline_timer timer; std::string nick_; Player(Connection::p c); //! Start communicating. void start(boost::function f); //! Handle Login-message. void handle_login(Message::p msg, boost::function lobby_callback); //! Handle Ready-message. void handle_ready(Message::p msg, boost::function ready_callback); //! Handle Action-message. void handle_action(Message::p msg, boost::function action_callback); public: //! The ID of the player int id; //! Return player's nick. std::string nick(); //! Notify client of a game start. void game_start(boost::function callback, std::vector players); //! Notify client of a round start. void round_start(); //! Send round state. void round_state(State state); //! Send round end. void round_end(); //! Get action. void get_action(boost::function callback); void kill_action(); }; typedef std::vector Players; #endif