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-17 15:19:34 +0000
committerStijn Buys <ingar@osirion.org>2010-09-17 15:19:34 +0000
commitc62fe609a69058e2e30f757e9a06f72a98464232 (patch)
tree53f6a671bd84924ddf7d278cf10a3e527670088e /src/core/netserver.cc
parent0c509866a37ab47ff0e48d357ca55e31658c37c2 (diff)
Bump network protocol version to 19, menudescriptions use the info infrastructure, client-side lazy info update requests.
Updated ROADMAP
Diffstat (limited to 'src/core/netserver.cc')
-rw-r--r--src/core/netserver.cc53
1 files changed, 6 insertions, 47 deletions
diff --git a/src/core/netserver.cc b/src/core/netserver.cc
index 0e44189..c632284 100644
--- a/src/core/netserver.cc
+++ b/src/core/netserver.cc
@@ -730,54 +730,13 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me
}
Info *info = 0;
- if (id == 0) {
- // the client is requesting an information record by type and label
- std::string typelabelstr;
- std::string infolabelstr;
- std::string n;
- char c;
-
- // read type label
- n.clear();
- while ((msgstream.get(c)) && (c != '"'));
- while ((msgstream.get(c)) && (c != '"'))
- n +=c;
- typelabelstr.assign(n);
- if (!typelabelstr.size()) {
- con_warn << "^B" << client->player()->name() << "^W invalid info request" << std::endl;
- return;
- }
-
- InfoType *infotype = InfoType::find(typelabelstr);
- if (!infotype)
- return;
-
- // read info label
- n.clear();
- while ((msgstream.get(c)) && (c != '"'));
- while ((msgstream.get(c)) && (c != '"'))
- n +=c;
- infolabelstr.assign(n);
- if (!infolabelstr.size()) {
- con_warn << "^B" << client->player()->name() << "^W invalid info request" << std::endl;
- return;
+ if (id) {
+ info = Info::find(id);
+ if (info) {
+ con_debug << "Sending info for " << info->id() << " " << info->type()->label() << ":" << info->label() << std::endl;
+ send_info_update(client, info);
+ client->transmit();
}
-
- //con_debug << "Received info request for " << infotype << ":" << infolabelstr << std::endl;
-
- info = Info::find(infotype, infolabelstr);
- } else {
- //con_debug << "Received info request for id " << id << std::endl;
-
- // the client is requesting an information record by id
- info = Info::find(id);
- }
-
- if (info) {
- //con_debug << "Sending info for " << info->id() << " " << info->type()->label() << ":" << info->label() << std::endl;
-
- send_info_update(client, info);
- client->transmit();
}
return;