TrinityCore
Loading...
Searching...
No Matches
UpdateData Class Reference

#include <UpdateData.h>

Public Member Functions

 UpdateData (uint32 map)
 
 UpdateData (UpdateData &&right) noexcept
 
void AddDestroyObject (ObjectGuid guid)
 
void AddOutOfRangeGUID (GuidSet &guids)
 
void AddOutOfRangeGUID (ObjectGuid guid)
 
void AddUpdateBlock ()
 
ByteBufferGetBuffer ()
 
bool BuildPacket (WorldPacket *packet)
 
bool HasData () const
 
void Clear ()
 
GuidSet const & GetOutOfRangeGUIDs () const
 

Protected Member Functions

 UpdateData (UpdateData const &right)=delete
 
UpdateDataoperator= (UpdateData const &right)=delete
 

Protected Attributes

uint32 m_map
 
uint32 m_blockCount
 
GuidSet m_destroyGUIDs
 
GuidSet m_outOfRangeGUIDs
 
ByteBuffer m_data
 

Constructor & Destructor Documentation

◆ UpdateData() [1/3]

UpdateData::UpdateData ( uint32  map)
23: m_map(map), m_blockCount(0) { }
uint32 m_blockCount
Definition: UpdateData.h:59
uint32 m_map
Definition: UpdateData.h:58

◆ UpdateData() [2/3]

UpdateData::UpdateData ( UpdateData &&  right)
inlinenoexcept
40 : m_map(right.m_map), m_blockCount(right.m_blockCount),
41 m_outOfRangeGUIDs(std::move(right.m_outOfRangeGUIDs)),
42 m_data(std::move(right.m_data))
43 {
44 }
ByteBuffer m_data
Definition: UpdateData.h:62
GuidSet m_outOfRangeGUIDs
Definition: UpdateData.h:61

◆ UpdateData() [3/3]

UpdateData::UpdateData ( UpdateData const &  right)
protecteddelete

Member Function Documentation

◆ AddDestroyObject()

void UpdateData::AddDestroyObject ( ObjectGuid  guid)
26{
27 m_destroyGUIDs.insert(guid);
28}
GuidSet m_destroyGUIDs
Definition: UpdateData.h:60
+ Here is the caller graph for this function:

◆ AddOutOfRangeGUID() [1/2]

void UpdateData::AddOutOfRangeGUID ( GuidSet guids)
31{
32 m_outOfRangeGUIDs.insert(guids.begin(), guids.end());
33}
+ Here is the caller graph for this function:

◆ AddOutOfRangeGUID() [2/2]

void UpdateData::AddOutOfRangeGUID ( ObjectGuid  guid)
36{
37 m_outOfRangeGUIDs.insert(guid);
38}

◆ AddUpdateBlock()

void UpdateData::AddUpdateBlock ( )
inline
49{ ++m_blockCount; }
+ Here is the caller graph for this function:

◆ BuildPacket()

bool UpdateData::BuildPacket ( WorldPacket packet)
41{
42 ASSERT(packet->empty()); // shouldn't happen
43 packet->Initialize(SMSG_UPDATE_OBJECT, 4 + 2 + 1 + (2 + 4 + 17 * (m_destroyGUIDs.size() + m_outOfRangeGUIDs.size())) + m_data.wpos());
44
45 *packet << uint32(m_blockCount);
46 *packet << uint16(m_map);
47
48 if (packet->WriteBit(!m_outOfRangeGUIDs.empty() || !m_destroyGUIDs.empty()))
49 {
50 *packet << uint16(m_destroyGUIDs.size());
51 *packet << uint32(m_destroyGUIDs.size() + m_outOfRangeGUIDs.size());
52
53 for (ObjectGuid const& destroyGuid : m_destroyGUIDs)
54 *packet << destroyGuid;
55
56 for (ObjectGuid const& outOfRangeGuid : m_outOfRangeGUIDs)
57 *packet << outOfRangeGuid;
58 }
59
60 *packet << uint32(m_data.size());
61 packet->append(m_data);
62 return true;
63}
uint16_t uint16
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:143
#define ASSERT
Definition: Errors.h:68
void append(T value)
Definition: ByteBuffer.h:143
size_t wpos() const
Definition: ByteBuffer.h:412
bool WriteBit(bool bit)
Definition: ByteBuffer.h:175
size_t size() const
Definition: ByteBuffer.h:538
bool empty() const
Definition: ByteBuffer.h:539
Definition: ObjectGuid.h:258
void Initialize(uint32 opcode, size_t newres=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition: WorldPacket.h:76
@ SMSG_UPDATE_OBJECT
Definition: Opcodes.h:2017
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Clear()

void UpdateData::Clear ( )
66{
67 m_data.clear();
68 m_destroyGUIDs.clear();
69 m_outOfRangeGUIDs.clear();
70 m_blockCount = 0;
71 m_map = 0;
72}
void clear()
Definition: ByteBuffer.h:133
+ Here is the call graph for this function:

◆ GetBuffer()

ByteBuffer & UpdateData::GetBuffer ( )
inline
50{ return m_data; }
+ Here is the caller graph for this function:

◆ GetOutOfRangeGUIDs()

GuidSet const & UpdateData::GetOutOfRangeGUIDs ( ) const
inline
55{ return m_outOfRangeGUIDs; }

◆ HasData()

bool UpdateData::HasData ( ) const
inline
52{ return m_blockCount > 0 || !m_outOfRangeGUIDs.empty() || !m_destroyGUIDs.empty(); }
+ Here is the caller graph for this function:

◆ operator=()

UpdateData & UpdateData::operator= ( UpdateData const &  right)
protecteddelete

Member Data Documentation

◆ m_blockCount

uint32 UpdateData::m_blockCount
protected

◆ m_data

ByteBuffer UpdateData::m_data
protected

◆ m_destroyGUIDs

GuidSet UpdateData::m_destroyGUIDs
protected

◆ m_map

uint32 UpdateData::m_map
protected

◆ m_outOfRangeGUIDs

GuidSet UpdateData::m_outOfRangeGUIDs
protected

The documentation for this class was generated from the following files: