This commit is contained in:
ZappoMan 2014-07-15 10:29:29 -07:00
parent 1eb472c43a
commit 61d998d2ad
3 changed files with 13 additions and 10 deletions

View file

@ -1081,6 +1081,12 @@ bool EntityItem::encodeEntityEditMessageDetails(PacketType command, EntityItemID
// assuming we have rome to fit our octalCode, proceed... // assuming we have rome to fit our octalCode, proceed...
if (success) { 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... // Now add our edit content details...
bool isNewEntityItem = (id.id == NEW_ENTITY); bool isNewEntityItem = (id.id == NEW_ENTITY);
@ -1122,14 +1128,11 @@ bool EntityItem::encodeEntityEditMessageDetails(PacketType command, EntityItemID
//qDebug() << "requestedProperties="; //qDebug() << "requestedProperties=";
//requestedProperties.debugDumpBits(); //requestedProperties.debugDumpBits();
LevelDetails entityLevel = packetData.startLevel();
bool successIDFits = packetData.appendValue(encodedID); bool successIDFits = packetData.appendValue(encodedID);
if (isNewEntityItem && successIDFits) { if (isNewEntityItem && successIDFits) {
successIDFits = packetData.appendValue(encodedToken); successIDFits = packetData.appendValue(encodedToken);
} }
bool successTypeFits = packetData.appendValue(encodedType); bool successTypeFits = packetData.appendValue(encodedType);
bool successLastEditedFits = packetData.appendValue(properties.getLastEdited());
bool successLastUpdatedFits = packetData.appendValue(encodedUpdateDelta); bool successLastUpdatedFits = packetData.appendValue(encodedUpdateDelta);
int propertyFlagsOffset = packetData.getUncompressedByteOffset(); int propertyFlagsOffset = packetData.getUncompressedByteOffset();

View file

@ -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! // NOTE: editPacketBuffer - is JUST the octcode/color and does not contain the packet header!
void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned char* codeColorBuffer, ssize_t length) { void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned char* editPacketBuffer, ssize_t length) {
if (!_shouldSend) { if (!_shouldSend) {
return; // bail early return; // bail early
@ -220,7 +220,7 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
// jurisdictions for processing // jurisdictions for processing
if (!serversExist()) { if (!serversExist()) {
if (_maxPendingMessages > 0) { if (_maxPendingMessages > 0) {
EditPacketBuffer* packet = new EditPacketBuffer(type, codeColorBuffer, length); EditPacketBuffer* packet = new EditPacketBuffer(type, editPacketBuffer, length);
_pendingPacketsLock.lock(); _pendingPacketsLock.lock();
_preServerPackets.push_back(packet); _preServerPackets.push_back(packet);
@ -253,7 +253,7 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
_serverJurisdictions->lockForRead(); _serverJurisdictions->lockForRead();
if ((*_serverJurisdictions).find(nodeUUID) != (*_serverJurisdictions).end()) { if ((*_serverJurisdictions).find(nodeUUID) != (*_serverJurisdictions).end()) {
const JurisdictionMap& map = (*_serverJurisdictions)[nodeUUID]; const JurisdictionMap& map = (*_serverJurisdictions)[nodeUUID];
isMyJurisdiction = (map.isMyJurisdiction(codeColorBuffer, CHECK_NODE_ONLY) == JurisdictionMap::WITHIN); isMyJurisdiction = (map.isMyJurisdiction(editPacketBuffer, CHECK_NODE_ONLY) == JurisdictionMap::WITHIN);
} else { } else {
isMyJurisdiction = false; 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 // We call this virtual function that allows our specific type of EditPacketSender to
// fixup the buffer for any clock skew // fixup the buffer for any clock skew
if (node->getClockSkewUsec() != 0) { 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; packetBuffer._currentSize += length;
} }
} }

View file

@ -90,7 +90,7 @@ public:
// you must override these... // you must override these...
virtual char getMyNodeType() const = 0; 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: public slots:
void nodeKilled(SharedNodePointer node); void nodeKilled(SharedNodePointer node);