#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; boost::function lobby_callback; boost::function ready_callback; boost::function action_callback; std::string nick_; Player(Connection::p c, boost::function f); //! Start communicating. void start(); //! Handle Login-message. void handle_login(Message::p msg); //! Handle Ready-message. void handle_ready(Message::p msg); //! Handle Action-message. void handle_action(Message::p msg); 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(); }; #endif