[7929] Some fixes and optimizations for work with packet guids.

* Allocate only minimal required buffer size for object packet guid cache, avoid it realocation.
* At adding aboyher buffer content copy only until wpos (really writed to buffer data)
* In appendPackGUID check buffer size before data write.
This commit is contained in:
VladimirMangos 2009-05-31 22:16:18 +04:00
parent 0bfcc44bb8
commit fb45529eff
4 changed files with 8 additions and 6 deletions

View file

@ -63,7 +63,7 @@ uint32 GuidHigh2TypeId(uint32 guid_hi)
return NUM_CLIENT_OBJECT_TYPES; // unknown
}
Object::Object( )
Object::Object( ) : m_PackGUID(sizeof(uint64)+1)
{
m_objectTypeId = TYPEID_OBJECT;
m_objectType = TYPEMASK_OBJECT;
@ -75,7 +75,6 @@ Object::Object( )
m_inWorld = false;
m_objectUpdated = false;
m_PackGUID.clear();
m_PackGUID.appendPackGUID(0);
}
@ -118,7 +117,7 @@ void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh )
uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh);
SetUInt64Value( OBJECT_FIELD_GUID, guid );
SetUInt32Value( OBJECT_FIELD_TYPE, m_objectType );
m_PackGUID.clear();
m_PackGUID.wpos(0);
m_PackGUID.appendPackGUID(GetGUID());
}