Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-07-10 20:19:14 +0000
committerStijn Buys <ingar@osirion.org>2011-07-10 20:19:14 +0000
commit02169591261cc09047117ddff961595717c8903a (patch)
tree7e4e207dd4cf01385036cd046e1d69c36d2d3040 /src/core
parente18fa1d8ad9208a9f5bcfe2d97d36ae3675c80f1 (diff)
Add player guid to the connection string .
Diffstat (limited to 'src/core')
-rw-r--r--src/core/gameconnection.cc2
-rw-r--r--src/core/netclient.cc2
-rw-r--r--src/core/netconnection.cc2
-rw-r--r--src/core/netconnection.h2
-rw-r--r--src/core/netserver.cc26
5 files changed, 23 insertions, 11 deletions
diff --git a/src/core/gameconnection.cc b/src/core/gameconnection.cc
index a62fb4f..ddf4610 100644
--- a/src/core/gameconnection.cc
+++ b/src/core/gameconnection.cc
@@ -73,6 +73,8 @@ GameConnection::GameConnection(std::string const &connectionstr)
ofs.close();
}
+ con_print << "Using client key " << localplayer()->guid().str() << std::endl;
+
// split hostname into host and port
unsigned int port = DEFAULTPORT;
std::string host(connectionstr);
diff --git a/src/core/netclient.cc b/src/core/netclient.cc
index 76112e1..35f355a 100644
--- a/src/core/netclient.cc
+++ b/src/core/netclient.cc
@@ -34,8 +34,6 @@ NetClient::NetClient(std::string host, int port, int fd) :
abort();
return;
}
- con_print << host << ":" << port << " connected" << std::endl;
-
client_addr.sin_family = AF_INET;
client_addr.sin_port = htons(port);
client_addr.sin_addr.s_addr = inet_addr(host.c_str());
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc
index fd844aa..3c68be9 100644
--- a/src/core/netconnection.cc
+++ b/src/core/netconnection.cc
@@ -338,7 +338,7 @@ void NetConnection::send_raw(std::string const &msg)
void NetConnection::send_connect()
{
std::ostringstream msg;
- msg << "connect " << PROTOCOLVERSION << "\n";
+ msg << "connect " << PROTOCOLVERSION << " " << localplayer()->guid().str() << "\n";
this->send_raw(msg.str());
}
diff --git a/src/core/netconnection.h b/src/core/netconnection.h
index dc5dc27..59371e0 100644
--- a/src/core/netconnection.h
+++ b/src/core/netconnection.h
@@ -66,7 +66,7 @@ public:
/// send an entity request
void send_entity_request(Entity *entity);
-
+
/// send a local chat message
void send_say(std::string const &text);
diff --git a/src/core/netserver.cc b/src/core/netserver.cc
index 12210a5..81bd303 100644
--- a/src/core/netserver.cc
+++ b/src/core/netserver.cc
@@ -298,12 +298,6 @@ NetClient * NetServer::client_connect(std::string const host, int const port)
void NetServer::client_initialize(NetClient *client)
{
- // send welcome message
- std::string welcome("^B");
- welcome.append(Cvar::sv_name->str());
- client->player()->send(welcome);
- client->transmit();
-
// send info types
send_infotypes(client);
client->transmit();
@@ -327,6 +321,18 @@ void NetServer::client_initialize(NetClient *client)
// set client state to pending
client->client_state = NetClient::Pending;
+
+ // send welcome message
+ std::string welcome("^B");
+ welcome.append(Cvar::sv_name->str());
+ send_message(client, Message::Info, welcome);
+
+ welcome.assign("^B");
+ welcome.append(Cvar::sv_description->str());
+ send_message(client, Message::Info, welcome);
+
+ client->transmit();
+
}
// send updates to one client
@@ -747,7 +753,13 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me
send_disconnect(client);
}
- // TODO add player uid to connect message
+ // player guid
+ std:: string guid;
+ if (msgstream >> guid) {
+ client->player()->guid().assign(guid);
+ }
+
+ con_print << client->host() << ":" << client->port() << " connected with UID " << client->player()->guid().str() << std::endl;
return;