Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-01-25 11:57:03 +0000
committerStijn Buys <ingar@osirion.org>2009-01-25 11:57:03 +0000
commitcc88902f93645b4284805f51cd7eba8b513ed5f3 (patch)
tree6dc0d22f16ed672a1b3e979f5a3814495f7c3a21 /src/core/netconnection.cc
parent6844f88a70a7b746b74696e80a21d9b8f740afcb (diff)
bump network protocol version to 15,
fix player level initialization, exchange player list, credits, level, ping
Diffstat (limited to 'src/core/netconnection.cc')
-rw-r--r--src/core/netconnection.cc43
1 files changed, 33 insertions, 10 deletions
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc
index eb9ad53..fc2b6bf 100644
--- a/src/core/netconnection.cc
+++ b/src/core/netconnection.cc
@@ -628,19 +628,16 @@ void NetConnection::parse_incoming_message(const std::string & message)
}
oldzone->content().clear();
}
- } else {
+
+ } else if (player_id != localplayer()->id()) {
+
// find player
Player *player = 0;
- if (player_id == connection()->localplayer()->id()) {
- // check localplayer
- player = connection()->localplayer();
- } else {
- // search other players
- for (GameInterface::Players::iterator it = game()->players().begin(); it != game()->players().end() && !player; it++) {
- if( (*it)->id() == player_id) {
- player = (*it);
- }
+ // search other players
+ for (GameInterface::Players::iterator it = game()->players().begin(); it != game()->players().end() && !player; it++) {
+ if( (*it)->id() == player_id) {
+ player = (*it);
}
}
@@ -650,8 +647,34 @@ void NetConnection::parse_incoming_message(const std::string & message)
}
player->receive_server_update(msgstream);
+ player->set_dirty(false);
+ }
+
+ } else if (command == "pid") {
+ con_debug << "Received player disconnect info" << std::endl;
+
+ int player_id;
+ if (!(msgstream >> player_id)) {
+ con_warn << "Received illegal player disconnect message!" << std::endl;
+ return;
+ }
+
+ // find player
+ if (player_id == connection()->localplayer()->id()) {
+ // ignore disconnect messages for local client
+ return;
}
+ // search other players
+ Player *player = 0;
+ for (GameInterface::Players::iterator it = game()->players().begin(); it != game()->players().end() && !player; it++) {
+ if( (*it)->id() == player_id) {
+ // TODO find player assets and set owner to 0
+ game()->players().erase(it);
+ return;
+ }
+ }
+
} else if (command == "sup") {
if (connection_state == Connected)
{