From c62fe609a69058e2e30f757e9a06f72a98464232 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 17 Sep 2010 15:19:34 +0000 Subject: Bump network protocol version to 19, menudescriptions use the info infrastructure, client-side lazy info update requests. Updated ROADMAP --- src/core/netserver.cc | 53 ++++++--------------------------------------------- 1 file changed, 6 insertions(+), 47 deletions(-) (limited to 'src/core/netserver.cc') 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; -- cgit v1.2.3