fixed div by zero

This commit is contained in:
ZappoMan 2014-02-26 21:38:28 -08:00
parent 6f1136c417
commit 2832c33482
3 changed files with 5 additions and 12 deletions

View file

@ -703,12 +703,3 @@ void OctreeServer::run() {
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000);
}
int OctreeServer::getPacketsPerClientPerInterval() const {
int totalEvenly = getPacketsTotalPerInterval() / getCurrentClientCount();
if (totalEvenly < 1) {
totalEvenly = 1;
}
int packetsPerClientPerInterval = std::min(_packetsPerClientPerInterval, totalEvenly);
return packetsPerClientPerInterval;
}

View file

@ -43,7 +43,9 @@ public:
Octree* getOctree() { return _tree; }
JurisdictionMap* getJurisdiction() { return _jurisdiction; }
int getPacketsPerClientPerInterval() const;
int getPacketsPerClientPerInterval() const { return std::min(_packetsPerClientPerInterval,
std::max(1, getPacketsTotalPerInterval() / std::max(1, getCurrentClientCount()))); }
int getPacketsPerClientPerSecond() const { return getPacketsPerClientPerInterval() * INTERVALS_PER_SECOND; }
int getPacketsTotalPerInterval() const { return _packetsTotalPerInterval; }
int getPacketsTotalPerSecond() const { return getPacketsTotalPerInterval() * INTERVALS_PER_SECOND; }

View file

@ -21,10 +21,10 @@ var orientation = Quat.fromPitchYawRoll(0, yaw, 0);
function init() {
if (isLocal) {
MyAvatar.position = {x: 10, y: 0, z: 10};
MyAvatar.position = {x: 5000, y: 500, z: 5000};
MyAvatar.orientation = orientation;
} else {
VoxelViewer.setPosition({x: 10, y: 0, z: 10});
VoxelViewer.setPosition({x: 5000, y: 500, z: 5000});
VoxelViewer.setOrientation(orientation);
VoxelViewer.queryOctree();
Agent.isAvatar = true;