mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 13:43:49 +02:00
reset buffer pointers in between sending to nodes
This commit is contained in:
parent
7fab3ea269
commit
b3d6c18902
1 changed files with 7 additions and 2 deletions
|
@ -58,8 +58,8 @@ void attachAvatarDataToNode(Node* newNode) {
|
|||
// determine which avatars are included in the packet stream
|
||||
// 4) we should optimize the avatar data format to be more compact (100 bytes is pretty wasteful).
|
||||
void broadcastAvatarData() {
|
||||
unsigned char broadcastPacketBuffer[MAX_PACKET_SIZE];
|
||||
unsigned char avatarDataBuffer[MAX_PACKET_SIZE];
|
||||
static unsigned char broadcastPacketBuffer[MAX_PACKET_SIZE];
|
||||
static unsigned char avatarDataBuffer[MAX_PACKET_SIZE];
|
||||
unsigned char* broadcastPacket = (unsigned char*)&broadcastPacketBuffer[0];
|
||||
int numHeaderBytes = populateTypeAndVersion(broadcastPacket, PACKET_TYPE_BULK_AVATAR_DATA);
|
||||
unsigned char* currentBufferPosition = broadcastPacket + numHeaderBytes;
|
||||
|
@ -70,6 +70,11 @@ void broadcastAvatarData() {
|
|||
|
||||
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
||||
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT && node->getActiveSocket()) {
|
||||
|
||||
// reset packet pointers for this node
|
||||
currentBufferPosition = broadcastPacket + numHeaderBytes;
|
||||
packetLength = currentBufferPosition - broadcastPacket;
|
||||
|
||||
// this is an AGENT we have received head data from
|
||||
// send back a packet with other active node data to this node
|
||||
for (NodeList::iterator otherNode = nodeList->begin(); otherNode != nodeList->end(); otherNode++) {
|
||||
|
|
Loading…
Reference in a new issue