AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WorldPackets Namespace Reference

Namespaces

namespace  Bank
 
namespace  Character
 
namespace  Chat
 
namespace  Combat
 
namespace  CombatLog
 
namespace  Guild
 
namespace  LFG
 
namespace  Misc
 
namespace  Pet
 
namespace  Strings
 
namespace  Totem
 
namespace  WorldState
 

Classes

class  Array
 
class  ClientPacket
 
class  CompactArray
 
class  IllegalHyperlinkException
 
class  InvalidHyperlinkException
 
class  InvalidStringValueException
 
class  InvalidUtf8ValueException
 
class  Packet
 
class  PacketArrayMaxCapacityException
 
class  ServerPacket
 
class  String
 

Functions

void CheckCompactArrayMaskOverflow (std::size_t index, std::size_t limit)
 
template<typename T >
ByteBufferoperator<< (ByteBuffer &data, CompactArray< T > const &v)
 
template<typename T >
ByteBufferoperator>> (ByteBuffer &data, CompactArray< T > &v)
 

Function Documentation

◆ CheckCompactArrayMaskOverflow()

void WorldPackets::CheckCompactArrayMaskOverflow ( std::size_t  index,
std::size_t  limit 
)
68{
69 ASSERT(index < limit, "Attempted to insert {} values into CompactArray but it can only hold {}", index, limit);
70}
#define ASSERT
Definition: Errors.h:68

References ASSERT.

Referenced by WorldPackets::CompactArray< T >::Insert().

◆ operator<<()

template<typename T >
ByteBuffer & WorldPackets::operator<< ( ByteBuffer data,
CompactArray< T > const &  v 
)
265 {
266 uint32 mask = v.GetMask();
267 data << uint32(mask);
268
269 for (std::size_t i = 0; i < v.GetSize(); ++i)
270 {
271 if (mask & (1 << i))
272 {
273 data << v[i];
274 }
275 }
276
277 return data;
278 }
std::uint32_t uint32
Definition: Define.h:108
uint32 GetMask() const
Definition: PacketUtilities.h:222
std::size_t GetSize() const
Definition: PacketUtilities.h:224

References WorldPackets::CompactArray< T >::GetMask(), and WorldPackets::CompactArray< T >::GetSize().

◆ operator>>()

template<typename T >
ByteBuffer & WorldPackets::operator>> ( ByteBuffer data,
CompactArray< T > &  v 
)
282 {
283 uint32 mask;
284 data >> mask;
285
286 for (std::size_t index = 0; mask != 0; mask >>= 1, ++index)
287 {
288 if ((mask & 1) != 0)
289 {
290 v.Insert(index, data.read<T>());
291 }
292 }
293
294 return data;
295 }
void Insert(std::size_t index, T const &value)
Definition: PacketUtilities.h:226
T read()
Definition: ByteBuffer.h:351

References WorldPackets::CompactArray< T >::Insert(), and ByteBuffer::read().