diff options
author | Ole Daniel Evensen <ole_daniel_evensen@hotmail.com> | 2010-12-06 19:30:28 +0100 |
---|---|---|
committer | Ole Daniel Evensen <ole_daniel_evensen@hotmail.com> | 2010-12-06 19:30:28 +0100 |
commit | b140aca7ab3ce6d312bc147a82dcf016af72eafd (patch) | |
tree | fc5437344c4e6a02b102d6290bb1a43c70d5d575 /server/client.h | |
parent | aead77e8995cba92515c10944ff6e37d68916575 (diff) |
some preliminary code and structure for dis-connection and re-connection.
Diffstat (limited to 'server/client.h')
-rw-r--r-- | server/client.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/client.h b/server/client.h index 3455056..676264e 100644 --- a/server/client.h +++ b/server/client.h @@ -16,6 +16,9 @@ class ClientBase { virtual ~ClientBase() {} + //! Return client's id. + virtual unsigned int id() = 0; + //! Return client's nick. virtual std::string nick() = 0; @@ -48,6 +51,8 @@ class Client : public ClientBase, public boost::enable_shared_from_this<Client> boost::asio::deadline_timer timer; + unsigned int id_; + std::string nick_; Client(Connection::p c); @@ -71,6 +76,9 @@ class Client : public ClientBase, public boost::enable_shared_from_this<Client> //! Inform client of lobby status (available game modes). void lobby_status(const std::vector<std::string>& game_modes, boost::function<void (int)> callback); + //! Return client's id. + virtual unsigned int id(); + //! Return client's nick. virtual std::string nick(); @@ -88,12 +96,20 @@ class Client : public ClientBase, public boost::enable_shared_from_this<Client> //! Get action. Upon connection error, last element of expected_actions will be provided. virtual void get_action(boost::function<void (Action)> callback, Actions expected_actions); + + //! Dis-connect a player. + virtual void disconnect(); + + //! Re-connect a player. + virtual void reconnect(Connection::p c); }; typedef std::vector<Client> Clients; class ClientDumb : public ClientBase { public: + virtual unsigned int id(); + virtual std::string nick(); virtual void game_start(boost::function<void ()> callback, std::vector<std::string> players); |