* Move readPackGUID from WorldPacket to ByteBuffer
This commit is contained in:
parent
8ca9e8949f
commit
fe8b5921ed
@ -2,18 +2,4 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
|
||||||
|
|
||||||
uint64 WorldPacket::GetPackedGuid(void)
|
|
||||||
{
|
|
||||||
uint8 mask;
|
|
||||||
*this >> mask;
|
|
||||||
uint64 guid=0;
|
|
||||||
for(uint8 i=0;i<8;i++)
|
|
||||||
{
|
|
||||||
if(mask & (1<<i) )
|
|
||||||
{
|
|
||||||
*this >> ((uint8*)&guid)[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return guid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,6 @@ public:
|
|||||||
WorldPacket(uint16 opcode) { _opcode=opcode; reserve(10); }
|
WorldPacket(uint16 opcode) { _opcode=opcode; reserve(10); }
|
||||||
inline void SetOpcode(uint16 opcode) { _opcode=opcode; }
|
inline void SetOpcode(uint16 opcode) { _opcode=opcode; }
|
||||||
inline uint16 GetOpcode(void) { return _opcode; }
|
inline uint16 GetOpcode(void) { return _opcode; }
|
||||||
uint64 GetPackedGuid(void);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16 _opcode;
|
uint16 _opcode;
|
||||||
@ -21,4 +20,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -272,6 +272,25 @@ class ByteBuffer
|
|||||||
if(buffer.size()) append(buffer.contents(),buffer.size());
|
if(buffer.size()) append(buffer.contents(),buffer.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64 readPackGUID()
|
||||||
|
{
|
||||||
|
uint64 guid = 0;
|
||||||
|
uint8 guidmark = 0;
|
||||||
|
(*this) >> guidmark;
|
||||||
|
|
||||||
|
for(int i = 0; i < 8; ++i)
|
||||||
|
{
|
||||||
|
if(guidmark & (uint8(1) << i))
|
||||||
|
{
|
||||||
|
uint8 bit;
|
||||||
|
(*this) >> bit;
|
||||||
|
guid |= (uint64(bit) << (i * 8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return guid;
|
||||||
|
}
|
||||||
|
|
||||||
void appendPackGUID(uint64 guid)
|
void appendPackGUID(uint64 guid)
|
||||||
{
|
{
|
||||||
if (_storage.size() < _wpos + sizeof(guid) + 1)
|
if (_storage.size() < _wpos + sizeof(guid) + 1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user