Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/netconnection.cc')
-rw-r--r--src/core/netconnection.cc37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc
index ba23df3..0bb33db 100644
--- a/src/core/netconnection.cc
+++ b/src/core/netconnection.cc
@@ -515,7 +515,7 @@ void NetConnection::parse_incoming_message(const std::string & message)
entity = new EntityGlobe(msgstream);
break;
default:
- con_warn << "Received create for unknown entity type " << type << std::endl;
+ con_warn << "Received create for unknown entity type " << type << "!" << std::endl;
return;
break;
}
@@ -527,6 +527,37 @@ void NetConnection::parse_incoming_message(const std::string & message)
game()->update_entity_clientstate(entity);
}
+ } else if (command == "menu") {
+
+ unsigned int id = 0;
+ if (msgstream >> id) {
+ if (!id) {
+ con_warn << "Received menu for NULL entity!" << std::endl;
+ return;
+ }
+
+ Entity *entity = Entity::find(id);
+ if (!entity) {
+ con_warn << "Received menu for unknown entity " << id << "!" << std::endl;
+ return;
+ }
+
+ MenuDescription *menu = Descriptions::receive(msgstream);
+ if (!menu->label().size()) {
+ con_warn << "Received menu without label for entity " << id << "!" << std::endl;
+ delete menu;
+ return;
+ }
+
+ // remove the menu if it already exists
+ entity->remove_menu(menu->label());
+
+ //con_debug << "receiving menu " << entity->label() << " " << menu->label() << std::endl;
+ entity->add_menu(menu);
+ } else {
+ con_warn << "Received illegal menu message!" << std::endl;
+ }
+
} else if (command.compare("zone") == 0) {
unsigned int id;
@@ -554,7 +585,7 @@ void NetConnection::parse_incoming_message(const std::string & message)
int player_id;
if (!(msgstream >> player_id)) {
- con_warn << "Received illegal update player info for player!" << std::endl;
+ con_warn << "Received illegal player info message!" << std::endl;
return;
}
@@ -607,7 +638,7 @@ void NetConnection::parse_incoming_message(const std::string & message)
Entity *entity = Entity::find(id);
if (!entity) {
// FIXME request entity from the server
- con_warn << "Update for unknown entity " << id << std::endl;
+ con_warn << "Update for unknown entity " << id << "!" << std::endl;
} else {
// FIXME check of the received update matches the actual entity
entity->receive_server_update(msgstream);