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>2008-07-22 17:20:37 +0000
committerStijn Buys <ingar@osirion.org>2008-07-22 17:20:37 +0000
commitbb8b4e081d33f4f1aca6ba23a78842e1fc9cd721 (patch)
tree8c0f370516368aee17636369f3decadf940b08d6
parent59ea9fffec01a6cc3fbf147aa311bfaa9abaa933 (diff)
verify owner on entity client updates
-rw-r--r--src/core/netserver.cc21
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;
}