From e84d8fe3355c13b47fb6c99469162475f5693340 Mon Sep 17 00:00:00 2001 From: Ambal Date: Tue, 12 Apr 2011 00:56:49 +0300 Subject: [PATCH] [11333] Reserve 9 bytes for PackedGuid buffer instead of 4096 to save RAM. Signed-off-by: Ambal --- src/game/ObjectGuid.h | 9 ++++++--- src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/game/ObjectGuid.h b/src/game/ObjectGuid.h index 03e837236..c8d3661ef 100644 --- a/src/game/ObjectGuid.h +++ b/src/game/ObjectGuid.h @@ -201,14 +201,17 @@ class MANGOS_DLL_SPEC ObjectGuid typedef std::set ObjectGuidSet; +//minimum buffer size for packed guid is 9 bytes +#define PACKED_GUID_MIN_BUFFER_SIZE 9 + class PackedGuid { friend ByteBuffer& operator<< (ByteBuffer& buf, PackedGuid const& guid); public: // constructors - explicit PackedGuid() { m_packedGuid.appendPackGUID(0); } - explicit PackedGuid(uint64 const& guid) { m_packedGuid.appendPackGUID(guid); } - explicit PackedGuid(ObjectGuid const& guid) { m_packedGuid.appendPackGUID(guid.GetRawValue()); } + explicit PackedGuid() : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(0); } + explicit PackedGuid(uint64 const& guid) : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(guid); } + explicit PackedGuid(ObjectGuid const& guid) : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(guid.GetRawValue()); } public: // modifiers void Set(uint64 const& guid) { m_packedGuid.wpos(0); m_packedGuid.appendPackGUID(guid); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5b784c74f..0bfc39d1f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11332" + #define REVISION_NR "11333" #endif // __REVISION_NR_H__