diff options
-rw-r--r-- | src/core/netserver.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/core/netserver.cc b/src/core/netserver.cc index ac24f33..065d695 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -556,12 +556,23 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me Entity *entity = Entity::find(id); if (!entity) { con_warn << client->host() << ":" << client->port() << " update for unknown entity " << id << "\n"; - - } else { - entity->entity_dirty = true; - entity->recieve_client_update(msgstream); + return; + } + + if (entity->type() == Entity::Controlable) { + con_warn << client->host() << ":" << client->port() << " update for non-controlable entity " << id << "\n"; + return; } - + + EntityControlable *entitycontrolable = (EntityControlable *)entity; + + if (entitycontrolable->owner() != client->player()) { + con_warn << client->host() << ":" << client->port() << " update for not-owned entity " << id << "\n"; + return; + } + + entitycontrolable->entity_dirty = true; + entitycontrolable->recieve_client_update(msgstream); } return; } |