summaryrefslogtreecommitdiff
path: root/server/player.h
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-11-15 08:24:55 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-11-15 08:24:55 +0100
commitc6a83f89ea55ba2071611513ac85b64134ac8f7b (patch)
treeecb2b4380931da4404d0af927f6645dcc51e81a9 /server/player.h
parent5c664afc0a91654ec2bd0be1e67995e7f61d27c7 (diff)
Added Player class.
Diffstat (limited to 'server/player.h')
-rw-r--r--server/player.h43
1 files changed, 27 insertions, 16 deletions
diff --git a/server/player.h b/server/player.h
index 8e04ab5..8b75885 100644
--- a/server/player.h
+++ b/server/player.h
@@ -1,26 +1,37 @@
-#ifndef PLAYER_H
+#ifndef PLAYER_H
#define PLAYER_H
#include <string>
#include <boost/shared_ptr.hpp>
-#include "connection.h"
-
-class Player{
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/function.hpp>
+
+#include "connection.h"
+
+class Player : public boost::enable_shared_from_this<Player> {
+ public:
+ typedef boost::shared_ptr<Player> p;
+
+ static p create(Connection::p c, boost::function<void (Player::p)> f);
+
private:
+ Connection::p connection;
+
+ boost::function<void (Player::p)> lobby_callback;
+
+ std::string nick_;
+
+ Player(Connection::p c, boost::function<void (Player::p)> f);
- //! A smart pointer to the players connection
- Connection::p connection_pointer;
+ //! Start communicating.
+ void start();
- //! The players nick
- std::string nick;
+ //! Handle login.
+ void handle_login(Message::p msg);
- //! Either generated or fetched from database. Not used yet.
- unsigned int id;
public:
- Player();
- ~Player();
+ //! Return player's nick.
+ std::string nick();
+};
- Player(const Connection::p& connection, const std::string& nick);
-};
-
-#endif // PLAYER_H_INCLUDED
+#endif