diff options
author | megamage <none@none> | 2008-12-27 11:39:40 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-12-27 11:39:40 -0600 |
commit | ae5e329321d0b6eec74672e47251c1845f578fb0 (patch) | |
tree | 4dfa87c3dd9319b58011cac040d5f11efa30210d /src/shared/ByteBuffer.h | |
parent | 8a337e26c5c41bc126f6fd0b3bfbb783fc6b8aa4 (diff) |
*Update to Mangos 6955.
--HG--
branch : trunk
Diffstat (limited to 'src/shared/ByteBuffer.h')
-rw-r--r-- | src/shared/ByteBuffer.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 9bdd6067fbc..efd704a4904 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -243,6 +243,32 @@ class ByteBuffer _rpos += len; } + bool readPackGUID(uint64& guid) + { + if(rpos()+1 > size()) + return false; + + guid = 0; + + uint8 guidmark=0; + (*this) >> guidmark; + + for(int i=0;i<8;i++) + { + if(guidmark & (uint8(1) << i)) + { + if(rpos()+1 > size()) + return false; + + uint8 bit; + (*this) >> bit; + guid |= (uint64(bit) << (i*8)); + } + } + + return true; + } + const uint8 *contents() const { return &_storage[0]; } size_t size() const { return _storage.size(); } |