From b140aca7ab3ce6d312bc147a82dcf016af72eafd Mon Sep 17 00:00:00 2001 From: Ole Daniel Evensen Date: Mon, 6 Dec 2010 19:30:28 +0100 Subject: some preliminary code and structure for dis-connection and re-connection. --- server/client.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'server/client.h') 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 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 //! Inform client of lobby status (available game modes). void lobby_status(const std::vector& game_modes, boost::function 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 //! Get action. Upon connection error, last element of expected_actions will be provided. virtual void get_action(boost::function callback, Actions expected_actions); + + //! Dis-connect a player. + virtual void disconnect(); + + //! Re-connect a player. + virtual void reconnect(Connection::p c); }; typedef std::vector Clients; class ClientDumb : public ClientBase { public: + virtual unsigned int id(); + virtual std::string nick(); virtual void game_start(boost::function callback, std::vector players); -- cgit v1.2.3