AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
UpdateData Class Reference

#include "UpdateData.h"

Public Member Functions

 UpdateData ()
 
void AddOutOfRangeGUID (ObjectGuid guid)
 
void AddUpdateBlock (const ByteBuffer &block)
 
void AddUpdateBlock (const UpdateData &block)
 
bool BuildPacket (WorldPacket &packet)
 
bool HasData () const
 
void Clear ()
 

Protected Attributes

uint32 m_blockCount
 
GuidVector m_outOfRangeGUIDs
 
ByteBuffer m_data
 

Detailed Description

Constructor & Destructor Documentation

◆ UpdateData()

UpdateData::UpdateData ( )
26 : m_blockCount(0)
27{
28 m_outOfRangeGUIDs.reserve(15);
29}
GuidVector m_outOfRangeGUIDs
Definition: UpdateData.h:65
uint32 m_blockCount
Definition: UpdateData.h:64

References m_outOfRangeGUIDs.

Member Function Documentation

◆ AddOutOfRangeGUID()

void UpdateData::AddOutOfRangeGUID ( ObjectGuid  guid)

◆ AddUpdateBlock() [1/2]

void UpdateData::AddUpdateBlock ( const ByteBuffer block)
37{
38 m_data.append(block);
40}
ByteBuffer m_data
Definition: UpdateData.h:66
void append(T value)
Definition: ByteBuffer.h:129

References ByteBuffer::append(), m_blockCount, and m_data.

Referenced by Object::BuildCreateUpdateBlockForPlayer(), Object::BuildMovementUpdateBlock(), and Object::BuildValuesUpdateBlockForPlayer().

◆ AddUpdateBlock() [2/2]

void UpdateData::AddUpdateBlock ( const UpdateData block)
43{
44 m_data.append(block.m_data);
46}

References ByteBuffer::append(), m_blockCount, and m_data.

◆ BuildPacket()

bool UpdateData::BuildPacket ( WorldPacket packet)
49{
50 ASSERT(packet.empty());
51
52 packet.reserve(4 + (m_outOfRangeGUIDs.empty() ? 0 : 1 + 4 + 9 * m_outOfRangeGUIDs.size()) + m_data.wpos());
53
54 packet << (uint32) (!m_outOfRangeGUIDs.empty() ? m_blockCount + 1 : m_blockCount);
55
56 if (!m_outOfRangeGUIDs.empty())
57 {
59 packet << (uint32) m_outOfRangeGUIDs.size();
60
61 for (ObjectGuid const& guid : m_outOfRangeGUIDs)
62 packet << guid.WriteAsPacked();
63 }
64
65 packet.append(m_data);
67
68 return true;
69}
#define ASSERT
Definition: Errors.h:68
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
@ UPDATETYPE_OUT_OF_RANGE_OBJECTS
Definition: UpdateData.h:32
@ SMSG_UPDATE_OBJECT
Definition: Opcodes.h:199
Definition: ObjectGuid.h:118
void SetOpcode(uint16 opcode)
Definition: WorldPacket.h:76
void reserve(std::size_t ressize)
Definition: ByteBuffer.h:454
std::size_t wpos() const
Definition: ByteBuffer.h:330
bool empty() const
Definition: ByteBuffer.h:445

References ByteBuffer::append(), ASSERT, ByteBuffer::empty(), m_blockCount, m_data, m_outOfRangeGUIDs, ByteBuffer::reserve(), WorldPacket::SetOpcode(), SMSG_UPDATE_OBJECT, UPDATETYPE_OUT_OF_RANGE_OBJECTS, and ByteBuffer::wpos().

Referenced by Group::AddMember(), Map::AddToMap(), spell_madrigosa_activate_barrier::HandleActivateObject(), spell_madrigosa_deactivate_barrier::HandleActivateObject(), spell_pri_lightwell_renew::HandleUpdateSpellclick(), Map::RemoveFromMap(), Map::SendInitSelf(), Map::SendInitTransports(), Map::SendRemoveTransports(), Acore::VisibleNotifier::SendToSelf(), BattlegroundSA::SendTransportInit(), BattlegroundSA::SendTransportsRemove(), Object::SendUpdateToPlayer(), Unit::SetOwnerGUID(), BattlegroundSA::StartShips(), GameObject::Update(), Player::UpdateForQuestWorldObjects(), and Player::UpdateTriggerVisibility().

◆ Clear()

void UpdateData::Clear ( )
72{
73 m_data.clear();
74 m_outOfRangeGUIDs.clear();
75 m_blockCount = 0;
76}
void clear()
Definition: ByteBuffer.h:122

References ByteBuffer::clear(), m_blockCount, m_data, and m_outOfRangeGUIDs.

Referenced by Map::SendInitSelf().

◆ HasData()

bool UpdateData::HasData ( ) const
inline

Member Data Documentation

◆ m_blockCount

uint32 UpdateData::m_blockCount
protected

◆ m_data

ByteBuffer UpdateData::m_data
protected

Referenced by AddUpdateBlock(), BuildPacket(), and Clear().

◆ m_outOfRangeGUIDs

GuidVector UpdateData::m_outOfRangeGUIDs
protected