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/netserver.cc')
-rw-r--r--src/core/netserver.cc32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/core/netserver.cc b/src/core/netserver.cc
index b674dbd..dd70bcf 100644
--- a/src/core/netserver.cc
+++ b/src/core/netserver.cc
@@ -330,19 +330,29 @@ void NetServer::client_frame(NetClient *client, float timestamp, float previoust
send_frame_marker(client, timestamp, previoustimestamp);
// send updates for entities in the zone
- for (Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
- Entity *entity = (*it);
+ for (Entity::Registry::iterator it = Entity::registry().begin(); it != Entity::registry().end(); it++) {
+ Entity *entity = (*it).second;
+
+ if (entity->zone() == zone) {
+ if (entity->entity_destroyed) {
+ if (!entity->entity_created) {
+ send_entity_delete(client, entity);
+ }
+ } else if (entity->entity_created) {
+ send_entity_create(client, entity);
- if (entity->entity_destroyed) {
- if (!entity->entity_created) {
- send_entity_delete(client, entity);
- }
- } else if (entity->entity_created) {
- send_entity_create(client, entity);
- } else if (entity->dirty() && !(entity->flags() & Entity::Static) ) {
+ } else if (entity->oldzone()) {
+ // this entity has entered the zone
+ send_entity_create(client, entity);
- // FIXME only within visual range
- send_entity_update(client, entity);
+ } else if (entity->dirty() && !(entity->flags() & Entity::Static) ) {
+
+ // FIXME only within visual range
+ send_entity_update(client, entity);
+ }
+ } else if (entity->oldzone() == zone) {
+ // the entity has left the zone
+ send_entity_delete(client, entity);
}
}
}