mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:03:41 +02:00
if a uuid is null, don't send a uuid of all zeros
This commit is contained in:
parent
f77038c52d
commit
c69aaa806b
2 changed files with 43 additions and 32 deletions
|
@ -88,17 +88,21 @@
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this doesn't need a length. See OctreePacketData::appendValue(const QUuid& uuid)
|
|
||||||
#define READ_ENTITY_PROPERTY_UUID(P,O) \
|
#define READ_ENTITY_PROPERTY_UUID(P,O) \
|
||||||
if (propertyFlags.getHasProperty(P)) { \
|
if (propertyFlags.getHasProperty(P)) { \
|
||||||
uint16_t length; \
|
uint16_t length; \
|
||||||
memcpy(&length, dataAt, sizeof(length)); \
|
memcpy(&length, dataAt, sizeof(length)); \
|
||||||
dataAt += sizeof(length); \
|
dataAt += sizeof(length); \
|
||||||
bytesRead += sizeof(length); \
|
bytesRead += sizeof(length); \
|
||||||
|
QUuid value; \
|
||||||
|
if (length == 0) { \
|
||||||
|
value = QUuid(); \
|
||||||
|
} else { \
|
||||||
QByteArray ba((const char*)dataAt, length); \
|
QByteArray ba((const char*)dataAt, length); \
|
||||||
QUuid value = QUuid::fromRfc4122(ba); \
|
value = QUuid::fromRfc4122(ba); \
|
||||||
dataAt += length; \
|
dataAt += length; \
|
||||||
bytesRead += length; \
|
bytesRead += length; \
|
||||||
|
} \
|
||||||
if (overwriteLocalData) { \
|
if (overwriteLocalData) { \
|
||||||
O(value); \
|
O(value); \
|
||||||
} \
|
} \
|
||||||
|
@ -144,17 +148,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: this doesn't need a length. See OctreePacketData::appendValue(const QUuid& uuid)
|
|
||||||
#define READ_ENTITY_PROPERTY_UUID_TO_PROPERTIES(P,O) \
|
#define READ_ENTITY_PROPERTY_UUID_TO_PROPERTIES(P,O) \
|
||||||
if (propertyFlags.getHasProperty(P)) { \
|
if (propertyFlags.getHasProperty(P)) { \
|
||||||
uint16_t length; \
|
uint16_t length; \
|
||||||
memcpy(&length, dataAt, sizeof(length)); \
|
memcpy(&length, dataAt, sizeof(length)); \
|
||||||
dataAt += sizeof(length); \
|
dataAt += sizeof(length); \
|
||||||
processedBytes += sizeof(length); \
|
processedBytes += sizeof(length); \
|
||||||
|
QUuid value; \
|
||||||
|
if (length == 0) { \
|
||||||
|
value = QUuid(); \
|
||||||
|
} else { \
|
||||||
QByteArray ba((const char*)dataAt, length); \
|
QByteArray ba((const char*)dataAt, length); \
|
||||||
QUuid value = QUuid::fromRfc4122(ba); \
|
value = QUuid::fromRfc4122(ba); \
|
||||||
dataAt += length; \
|
dataAt += length; \
|
||||||
processedBytes += length; \
|
processedBytes += length; \
|
||||||
|
} \
|
||||||
properties.O(value); \
|
properties.O(value); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -412,14 +412,17 @@ bool OctreePacketData::appendValue(const QString& string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OctreePacketData::appendValue(const QUuid& uuid) {
|
bool OctreePacketData::appendValue(const QUuid& uuid) {
|
||||||
// TODO: this doesn't need a length
|
|
||||||
QByteArray bytes = uuid.toRfc4122();
|
QByteArray bytes = uuid.toRfc4122();
|
||||||
|
if (uuid.isNull()) {
|
||||||
|
return appendValue((uint16_t)0); // zero length for null uuid
|
||||||
|
} else {
|
||||||
uint16_t length = bytes.size();
|
uint16_t length = bytes.size();
|
||||||
bool success = appendValue(length);
|
bool success = appendValue(length);
|
||||||
if (success) {
|
if (success) {
|
||||||
success = appendRawData((const unsigned char*)bytes.constData(), bytes.size());
|
success = appendRawData((const unsigned char*)bytes.constData(), bytes.size());
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OctreePacketData::appendValue(const QByteArray& bytes) {
|
bool OctreePacketData::appendValue(const QByteArray& bytes) {
|
||||||
|
|
Loading…
Reference in a new issue