mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
fix push bytesRead when creating dummy Avatar packets, closes #1794
This commit is contained in:
parent
4573eaebc6
commit
2cc6d22181
2 changed files with 6 additions and 7 deletions
|
@ -70,7 +70,7 @@ void broadcastAvatarData() {
|
|||
QByteArray avatarByteArray;
|
||||
avatarByteArray.append(otherNode->getUUID().toRfc4122());
|
||||
|
||||
AvatarData *nodeData = (AvatarData *)otherNode->getLinkedData();
|
||||
AvatarData* nodeData = (AvatarData*) otherNode->getLinkedData();
|
||||
avatarByteArray.append(nodeData->toByteArray());
|
||||
|
||||
if (avatarByteArray.size() + mixedAvatarByteArray.size() > MAX_PACKET_SIZE) {
|
||||
|
|
|
@ -206,7 +206,8 @@ void AvatarManager::processAvatarMixerDatagram(const QByteArray& datagram, const
|
|||
int bytesRead = numBytesForPacketHeader(datagram);
|
||||
|
||||
QByteArray dummyAvatarByteArray = byteArrayWithPopluatedHeader(PacketTypeAvatarData);
|
||||
int numDummyByteArrayHeaderBytes = dummyAvatarByteArray.size();
|
||||
int numDummyHeaderBytes = dummyAvatarByteArray.size();
|
||||
int numDummyHeaderBytesWithoutUUID = numDummyHeaderBytes - NUM_BYTES_RFC4122_UUID;
|
||||
|
||||
// enumerate over all of the avatars in this packet
|
||||
// only add them if mixerWeakPointer points to something (meaning that mixer is still around)
|
||||
|
@ -233,15 +234,13 @@ void AvatarManager::processAvatarMixerDatagram(const QByteArray& datagram, const
|
|||
}
|
||||
|
||||
// copy the rest of the packet to the avatarData holder so we can read the next Avatar from there
|
||||
dummyAvatarByteArray.resize(numDummyByteArrayHeaderBytes);
|
||||
dummyAvatarByteArray.resize(numDummyHeaderBytesWithoutUUID);
|
||||
|
||||
// make this Avatar's UUID the UUID in the packet and tack the remaining data onto the end
|
||||
dummyAvatarByteArray.replace(numDummyByteArrayHeaderBytes - NUM_BYTES_RFC4122_UUID,
|
||||
datagram.size() - bytesRead,
|
||||
datagram.mid(bytesRead));
|
||||
dummyAvatarByteArray.append(datagram.mid(bytesRead));
|
||||
|
||||
// have the matching (or new) avatar parse the data from the packet
|
||||
bytesRead += matchingAvatar->parseData(dummyAvatarByteArray);
|
||||
bytesRead += matchingAvatar->parseData(dummyAvatarByteArray) - numDummyHeaderBytesWithoutUUID;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue