Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-11-25 21:27:25 +0000
committerStijn Buys <ingar@osirion.org>2012-11-25 21:27:25 +0000
commit47c1069cd2cb6ff34ea93c1f395c5e1bdd9f1432 (patch)
tree9c87c3bb7b98d0ac09cbe3b74bf0d6917e3af374 /src/core
parentc7ce266051705c68f3440bcc5a83833536b2b7ca (diff)
Added server-side distance check before sending entity create messages for projectiles.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/netserver.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/netserver.cc b/src/core/netserver.cc
index 9fb5f78..467be4d 100644
--- a/src/core/netserver.cc
+++ b/src/core/netserver.cc
@@ -28,6 +28,7 @@
#include "core/cvar.h"
#include "core/func.h"
#include "core/core.h"
+#include "core/range.h"
#include "core/stats.h"
#include "core/zone.h"
@@ -366,6 +367,14 @@ void NetServer::client_frame(NetClient *client, unsigned long timestamp)
} else {
// send a server frame marker
send_frame_marker(client, server()->timer().timestamp());
+
+ // client location for server-side distance checks
+ math::Vector3f location;
+ if (client->player()->control()) {
+ location.assign(client->player()->control()->location());
+ } else if (client->player()->view()) {
+ location.assign(client->player()->view()->location());
+ }
// send updates for entities in the zone
for (Entity::Registry::iterator it = Entity::registry().begin(); it != Entity::registry().end(); it++) {
@@ -377,7 +386,9 @@ void NetServer::client_frame(NetClient *client, unsigned long timestamp)
send_entity_delete(client, entity);
}
} else if (entity->entity_created) {
- send_entity_create(client, entity);
+ if ((entity->type() != Entity::Projectile) || (math::distance(location, entity->location()) < range::fxdistance)) {
+ send_entity_create(client, entity);
+ }
} else if (entity->oldzone()) {
// this entity has entered the zone