From 84ef757af43ed022919b4fc37437b4aa43e63783 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 30 Jan 2014 09:45:09 -0800 Subject: [PATCH] fix avatar count, HandData crash (closes #1754) --- interface/src/Application.cpp | 3 ++- interface/src/avatar/AvatarManager.cpp | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2efcd5b121..b30fc37591 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3225,7 +3225,8 @@ void Application::displayStats() { glPointSize(1.0f); - int totalAvatars = _avatarManager.size(); + // we need to take one avatar out so we don't include ourselves + int totalAvatars = _avatarManager.size() - 1; int totalServers = NodeList::getInstance()->size(); if (mirrorEnabled) { diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index 06b550b9d6..57f187603b 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -234,7 +234,11 @@ 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 += datagram.mid(bytesRead); + + // 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, + NUM_BYTES_RFC4122_UUID + datagram.size() - bytesRead, + datagram.mid(bytesRead)); // have the matching (or new) avatar parse the data from the packet bytesRead += matchingAvatar->parseData(dummyAvatarByteArray);