Skip to content

Commit

Permalink
[11333] Reserve 9 bytes for PackedGuid buffer instead of 4096 to save…
Browse files Browse the repository at this point in the history
… RAM.

Signed-off-by: Ambal <pogrebniak@gala.net>
  • Loading branch information
Ambal committed Apr 11, 2011
1 parent 458f9ef commit 1b38a6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/game/ObjectGuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,17 @@ class MANGOS_DLL_SPEC ObjectGuid

typedef std::set<ObjectGuid> 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); }
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11332"
#define REVISION_NR "11333"
#endif // __REVISION_NR_H__

2 comments on commit 1b38a6d

@Ambal
Copy link
Contributor

@Ambal Ambal commented on 1b38a6d Apr 12, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every single item/unit/GO in world has its own PackedGuid object so RAM savings might be noticable.

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch :)

Please sign in to comment.