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>2010-09-25 13:01:26 +0000
committerStijn Buys <ingar@osirion.org>2010-09-25 13:01:26 +0000
commitaeef4449ce3c1bdc531fb90699fef68bd48ca644 (patch)
tree969c2ec24f382a6a75e01b1b3315dd9fe8f26d46 /src/core/netconnection.cc
parent158706fac974527436a3167cfa94a7ea82070d41 (diff)
trading bugfixes: corrects client side screen update issues
Diffstat (limited to 'src/core/netconnection.cc')
-rw-r--r--src/core/netconnection.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc
index 11e23c9..3318c1e 100644
--- a/src/core/netconnection.cc
+++ b/src/core/netconnection.cc
@@ -432,7 +432,7 @@ void NetConnection::send_info_request(Info *info)
msg << "inf " << info->id() << "\n";
this->send_raw(msg.str());
- info->set_timestamp(timestamp());
+ info->set_timestamp(application()->timestamp());
}
// send an inventory update request
@@ -871,9 +871,9 @@ void NetConnection::parse_incoming_message(const std::string & message)
info->receive_server_update(msgstream);
//info->clear_timestamp();
- info->set_timestamp(timestamp());
+ info->set_timestamp(application()->timestamp());
- //con_debug << "Received info for " << info->id() << " " << info->type()->label() << ":" << info->label() << std::endl;
+ //con_debug << "CLIENT info for " << info->id() << " " << info->type()->label() << ":" << info->label() << " timestamp " << info->timestamp() << std::endl;
} else if (command.compare("inv") == 0) {
@@ -897,9 +897,8 @@ void NetConnection::parse_incoming_message(const std::string & message)
return;
}
- //con_debug << "CLIENT received inv message for entity " << id << " server timestamp " << server_timestamp << " client timestamp " << entity->inventory()->timestamp() << std::endl;
-
-
+ //con_debug << "CLIENT received inv message for entity " << id << " client timestamp " << entity->inventory()->timestamp() << " server timestamp " << server_timestamp << std::endl;
+
if (server_timestamp < entity->inventory()->timestamp())
return;
@@ -907,7 +906,7 @@ void NetConnection::parse_incoming_message(const std::string & message)
if (!(msgstream >> nbitems))
nbitems = 0;
- //con_debug << "CLIENT number of items: " << nbitems << std::endl;
+ //con_debug << "CLIENT number of items: " << nbitems << std::endl;
for (size_t i = 0; i < nbitems; i++) {
if (!(msgstream >> id)) {
con_warn << "Received inventory update without info id for existing entity " << id << "!" << std::endl;
@@ -922,9 +921,11 @@ void NetConnection::parse_incoming_message(const std::string & message)
}
item->receive_server_update(msgstream);
}
-
- entity->inventory()->set_timestamp(server_timestamp);
+
entity->inventory()->recalculate();
+ entity->inventory()->set_timestamp(server_timestamp);
+
+ //con_debug << "CLIENT inventory updated timestamp " << entity->inventory()->timestamp() << " for " << nbitems << " items" << std::endl;
}
}