summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle Daniel Evensen <daniel@ICE.(none)>2010-11-08 11:43:32 +0100
committerOle Daniel Evensen <daniel@ICE.(none)>2010-11-08 11:43:32 +0100
commitdbe36b02350464b41510bf282531ed028ebae038 (patch)
treeb93deff6b978bf9a1e436f4b12e65b0a30f8690f
parentbbed785b301bd9380080489ad7b2f10f777b496d (diff)
Added smartpointer to connection in player, rather than storing ip and port.
-rw-r--r--server/player.cpp5
-rw-r--r--server/player.h21
2 files changed, 15 insertions, 11 deletions
diff --git a/server/player.cpp b/server/player.cpp
index 9530c10..e1796d8 100644
--- a/server/player.cpp
+++ b/server/player.cpp
@@ -3,8 +3,7 @@
Player::Player(){}
Player::~Player(){}
-Player::Player(std::string& ip, std::string& port, std::string& nick){
- this->ip = ip;
- this->port = port;
+Player::Player(const Connection::p& connection, const std::string& nick){
+ this->connection_pointer = connection;
this->nick = nick;
}
diff --git a/server/player.h b/server/player.h
index c2cecdf..8e04ab5 100644
--- a/server/player.h
+++ b/server/player.h
@@ -1,21 +1,26 @@
#ifndef PLAYER_H
#define PLAYER_H
-#include <string>
+#include <string>
+#include <boost/shared_ptr.hpp>
+#include "connection.h"
class Player{
private:
- //What the server needs to get in contact with player.
- std::string ip;
- std::string port;
- std::string nick;//The players nick
-
- unsigned int id;//Either generated or fetched from database
+
+ //! A smart pointer to the players connection
+ Connection::p connection_pointer;
+
+ //! The players nick
+ std::string nick;
+
+ //! Either generated or fetched from database. Not used yet.
+ unsigned int id;
public:
Player();
~Player();
- Player(std::string& ip, std::string& port, std::string& nick);
+ Player(const Connection::p& connection, const std::string& nick);
};
#endif // PLAYER_H_INCLUDED