mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
have assignment client pay attention to jurisdictions
This commit is contained in:
parent
8aad3e146f
commit
3df07d344f
4 changed files with 21 additions and 3 deletions
|
@ -201,7 +201,13 @@ void Agent::run() {
|
|||
|
||||
while (NodeList::getInstance()->getNodeSocket()->receive((sockaddr*) &senderAddress, receivedData, &receivedBytes)
|
||||
&& packetVersionMatch(receivedData)) {
|
||||
NodeList::getInstance()->processNodeData((sockaddr*) &senderAddress, receivedData, receivedBytes);
|
||||
if (receivedData[0] == PACKET_TYPE_VOXEL_JURISDICTION) {
|
||||
voxelScripter.getJurisdictionListener()->queueReceivedPacket((sockaddr&) senderAddress,
|
||||
receivedData,
|
||||
receivedBytes);
|
||||
} else {
|
||||
NodeList::getInstance()->processNodeData((sockaddr*) &senderAddress, receivedData, receivedBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
|
||||
#include "VoxelScriptingInterface.h"
|
||||
|
||||
VoxelScriptingInterface::VoxelScriptingInterface() {
|
||||
_jurisdictionListener.initialize(true);
|
||||
_voxelPacketSender.setVoxelServerJurisdictions(_jurisdictionListener.getJurisdictions());
|
||||
}
|
||||
|
||||
void VoxelScriptingInterface::queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails) {
|
||||
_voxelPacketSender.queueVoxelEditMessages(addPacketType, 1, &addVoxelDetails);
|
||||
}
|
||||
|
@ -35,4 +40,4 @@ void VoxelScriptingInterface::queueVoxelDelete(float x, float y, float z, float
|
|||
VoxelDetail deleteVoxelDetail = {x, y, z, scale, 0, 0, 0};
|
||||
|
||||
_voxelPacketSender.queueVoxelEditMessages(PACKET_TYPE_ERASE_VOXEL, 1, &deleteVoxelDetail);
|
||||
}
|
||||
}
|
|
@ -11,13 +11,17 @@
|
|||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include <JurisdictionListener.h>
|
||||
#include <VoxelEditPacketSender.h>
|
||||
|
||||
/// handles scripting of voxel commands from JS passed to assigned clients
|
||||
class VoxelScriptingInterface : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VoxelScriptingInterface();
|
||||
|
||||
VoxelEditPacketSender* getVoxelPacketSender() { return &_voxelPacketSender; }
|
||||
JurisdictionListener* getJurisdictionListener() { return &_jurisdictionListener; }
|
||||
public slots:
|
||||
/// queues the creation of a voxel which will be sent by calling process on the PacketSender
|
||||
/// \param x the x-coordinate of the voxel (in VS space)
|
||||
|
@ -48,6 +52,7 @@ public slots:
|
|||
private:
|
||||
/// attached VoxelEditPacketSender that handles queuing and sending of packets to VS
|
||||
VoxelEditPacketSender _voxelPacketSender;
|
||||
JurisdictionListener _jurisdictionListener;
|
||||
|
||||
void queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails);
|
||||
};
|
||||
|
|
|
@ -74,8 +74,10 @@ bool PacketSender::process() {
|
|||
// we can determine how many packets we need to send per call to achieve our desired
|
||||
// packets per second send rate.
|
||||
int callsPerSecond = USECS_PER_SECOND / averageCallTime;
|
||||
|
||||
// make sure our number of calls per second doesn't cause a divide by zero
|
||||
glm::clamp(callsPerSecond, 1, _packetsPerSecond);
|
||||
callsPerSecond = glm::clamp(callsPerSecond, 1, _packetsPerSecond);
|
||||
|
||||
packetsPerCall = ceil(_packetsPerSecond / callsPerSecond);
|
||||
|
||||
// send at least one packet per call, if we have it
|
||||
|
|
Loading…
Reference in a new issue