mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
tweaks
This commit is contained in:
parent
1eb472c43a
commit
61d998d2ad
3 changed files with 13 additions and 10 deletions
|
@ -1081,6 +1081,12 @@ bool EntityItem::encodeEntityEditMessageDetails(PacketType command, EntityItemID
|
|||
// assuming we have rome to fit our octalCode, proceed...
|
||||
if (success) {
|
||||
|
||||
LevelDetails entityLevel = packetData.startLevel();
|
||||
|
||||
// Last Edited quint64 always first, before any other details, which allows us easy access to adjusting this
|
||||
// timestamp for clock skew
|
||||
bool successLastEditedFits = packetData.appendValue(properties.getLastEdited());
|
||||
|
||||
// Now add our edit content details...
|
||||
bool isNewEntityItem = (id.id == NEW_ENTITY);
|
||||
|
||||
|
@ -1122,14 +1128,11 @@ bool EntityItem::encodeEntityEditMessageDetails(PacketType command, EntityItemID
|
|||
//qDebug() << "requestedProperties=";
|
||||
//requestedProperties.debugDumpBits();
|
||||
|
||||
LevelDetails entityLevel = packetData.startLevel();
|
||||
|
||||
bool successIDFits = packetData.appendValue(encodedID);
|
||||
if (isNewEntityItem && successIDFits) {
|
||||
successIDFits = packetData.appendValue(encodedToken);
|
||||
}
|
||||
bool successTypeFits = packetData.appendValue(encodedType);
|
||||
bool successLastEditedFits = packetData.appendValue(properties.getLastEdited());
|
||||
bool successLastUpdatedFits = packetData.appendValue(encodedUpdateDelta);
|
||||
|
||||
int propertyFlagsOffset = packetData.getUncompressedByteOffset();
|
||||
|
|
|
@ -209,8 +209,8 @@ void OctreeEditPacketSender::queuePacketToNodes(unsigned char* buffer, ssize_t l
|
|||
}
|
||||
|
||||
|
||||
// NOTE: codeColorBuffer - is JUST the octcode/color and does not contain the packet header!
|
||||
void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned char* codeColorBuffer, ssize_t length) {
|
||||
// NOTE: editPacketBuffer - is JUST the octcode/color and does not contain the packet header!
|
||||
void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned char* editPacketBuffer, ssize_t length) {
|
||||
|
||||
if (!_shouldSend) {
|
||||
return; // bail early
|
||||
|
@ -220,7 +220,7 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
|
|||
// jurisdictions for processing
|
||||
if (!serversExist()) {
|
||||
if (_maxPendingMessages > 0) {
|
||||
EditPacketBuffer* packet = new EditPacketBuffer(type, codeColorBuffer, length);
|
||||
EditPacketBuffer* packet = new EditPacketBuffer(type, editPacketBuffer, length);
|
||||
_pendingPacketsLock.lock();
|
||||
_preServerPackets.push_back(packet);
|
||||
|
||||
|
@ -253,7 +253,7 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
|
|||
_serverJurisdictions->lockForRead();
|
||||
if ((*_serverJurisdictions).find(nodeUUID) != (*_serverJurisdictions).end()) {
|
||||
const JurisdictionMap& map = (*_serverJurisdictions)[nodeUUID];
|
||||
isMyJurisdiction = (map.isMyJurisdiction(codeColorBuffer, CHECK_NODE_ONLY) == JurisdictionMap::WITHIN);
|
||||
isMyJurisdiction = (map.isMyJurisdiction(editPacketBuffer, CHECK_NODE_ONLY) == JurisdictionMap::WITHIN);
|
||||
} else {
|
||||
isMyJurisdiction = false;
|
||||
}
|
||||
|
@ -280,10 +280,10 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
|
|||
// We call this virtual function that allows our specific type of EditPacketSender to
|
||||
// fixup the buffer for any clock skew
|
||||
if (node->getClockSkewUsec() != 0) {
|
||||
adjustEditPacketForClockSkew(codeColorBuffer, length, node->getClockSkewUsec());
|
||||
adjustEditPacketForClockSkew(editPacketBuffer, length, node->getClockSkewUsec());
|
||||
}
|
||||
|
||||
memcpy(&packetBuffer._currentBuffer[packetBuffer._currentSize], codeColorBuffer, length);
|
||||
memcpy(&packetBuffer._currentBuffer[packetBuffer._currentSize], editPacketBuffer, length);
|
||||
packetBuffer._currentSize += length;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
|
||||
// you must override these...
|
||||
virtual char getMyNodeType() const = 0;
|
||||
virtual void adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssize_t length, int clockSkew) { };
|
||||
virtual void adjustEditPacketForClockSkew(unsigned char* editPacketBuffer, ssize_t length, int clockSkew) { };
|
||||
|
||||
public slots:
|
||||
void nodeKilled(SharedNodePointer node);
|
||||
|
|
Loading…
Reference in a new issue