Core/PacketIO: Use ByteBuffer from UpdateData instead of copying to it after (#28347)

This commit is contained in:
Gosha
2022-10-11 23:18:54 +03:00
committed by GitHub
parent 0d0954b355
commit 81bf8de989
3 changed files with 8 additions and 13 deletions

View File

@@ -166,14 +166,14 @@ void Object::RemoveFromWorld()
void Object::BuildMovementUpdateBlock(UpdateData* data, uint32 flags) const
{
ByteBuffer buf(500);
ByteBuffer& buf = data->GetBuffer();
buf << uint8(UPDATETYPE_MOVEMENT);
buf << GetPackGUID();
BuildMovementUpdate(&buf, flags);
data->AddUpdateBlock(buf);
data->AddUpdateBlock();
}
void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const
@@ -196,14 +196,14 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
//TC_LOG_DEBUG("BuildCreateUpdate: update-type: %u, object-type: %u got flags: %X, flags2: %X", updateType, m_objectTypeId, flags, flags2);
ByteBuffer buf(500);
ByteBuffer& buf = data->GetBuffer();
buf << uint8(updateType);
buf << GetPackGUID();
buf << uint8(m_objectTypeId);
BuildMovementUpdate(&buf, flags);
BuildValuesUpdate(updateType, &buf, target);
data->AddUpdateBlock(buf);
data->AddUpdateBlock();
}
void Object::SendUpdateToPlayer(Player* player)
@@ -222,14 +222,14 @@ void Object::SendUpdateToPlayer(Player* player)
void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player const* target) const
{
ByteBuffer buf(500);
ByteBuffer& buf = data->GetBuffer();
buf << uint8(UPDATETYPE_VALUES);
buf << GetPackGUID();
BuildValuesUpdate(UPDATETYPE_VALUES, &buf, target);
data->AddUpdateBlock(buf);
data->AddUpdateBlock();
}
void Object::BuildOutOfRangeUpdateBlock(UpdateData* data) const