Index: src/game/Object.cpp =================================================================== --- src/game/Object.cpp (revision 3282) +++ src/game/Object.cpp (working copy) @@ -26,6 +26,7 @@ #include "ObjectMgr.h" #include "WorldSession.h" #include "UpdateData.h" +#include "UpdateMask.h" #include "Util.h" #include "MapManager.h" #include "ObjectAccessor.h" @@ -40,6 +41,7 @@ m_objectType = TYPE_OBJECT; m_uint32Values = 0; + m_uint32Values_mirror = 0; m_valuesCount = 0; m_inWorld = false; @@ -56,10 +58,23 @@ { //DEBUG_LOG("Object desctr 1 check (%p)",(void*)this); delete [] m_uint32Values; + delete [] m_uint32Values_mirror; //DEBUG_LOG("Object desctr 2 check (%p)",(void*)this); } } +void Object::_InitValues() +{ + m_uint32Values = new uint32[ m_valuesCount ]; + memset(m_uint32Values, 0, m_valuesCount*sizeof(uint32)); + + m_uint32Values_mirror = new uint32[ m_valuesCount ]; + memset(m_uint32Values_mirror, 0, m_valuesCount*sizeof(uint32)); + + m_objectUpdated = false; +} + + void Object::_Create( uint32 guidlow, uint32 guidhigh ) { if(!m_uint32Values) _InitValues(); @@ -169,6 +184,7 @@ UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); + _SetUpdateBits( &updateMask, target ); _BuildValuesUpdate( &buf, &updateMask ); @@ -356,7 +372,11 @@ void Object::_SetUpdateBits(UpdateMask *updateMask, Player *target) const { - *updateMask = m_updateMask; + for( uint16 index = 0; index < m_valuesCount; index ++ ) + { + if(m_uint32Values_mirror[index]!= m_uint32Values[index]) + updateMask->SetBit(index); + } } void Object::_SetCreateBits(UpdateMask *updateMask, Player *target) const @@ -377,8 +397,6 @@ if(m_inWorld) { - m_updateMask.SetBit( index ); - if(!m_objectUpdated) { ObjectAccessor::Instance().AddUpdateObject(this); @@ -398,9 +416,6 @@ if(m_inWorld) { - m_updateMask.SetBit( index ); - m_updateMask.SetBit( index + 1 ); - if(!m_objectUpdated) { ObjectAccessor::Instance().AddUpdateObject(this); @@ -419,8 +434,6 @@ if(m_inWorld) { - m_updateMask.SetBit( index ); - if(!m_objectUpdated) { ObjectAccessor::Instance().AddUpdateObject(this); @@ -460,8 +473,6 @@ if(m_inWorld) { - m_updateMask.SetBit( index ); - if(!m_objectUpdated) { ObjectAccessor::Instance().AddUpdateObject(this); @@ -483,8 +494,6 @@ if(m_inWorld) { - m_updateMask.SetBit( index ); - if(!m_objectUpdated) { ObjectAccessor::Instance().AddUpdateObject(this); Index: src/game/Object.h =================================================================== --- src/game/Object.h (revision 3282) +++ src/game/Object.h (working copy) @@ -21,10 +21,9 @@ #include "Common.h" #include "ByteBuffer.h" -#include "UpdateMask.h" #include "World.h" #include "QuestDef.h" - +#include "UpdateFields.h" #include #ifndef M_PI @@ -68,6 +67,7 @@ class WorldSession; class Player; class MapCell; +class UpdateMask; class MANGOS_DLL_SPEC Object { @@ -162,7 +162,11 @@ void ClearUpdateMask( ) { - m_updateMask.Clear(); + for( uint16 index = 0; index < m_valuesCount; index ++ ) + { + if(m_uint32Values_mirror[index]!= m_uint32Values[index]) + m_uint32Values_mirror[index] = m_uint32Values[index]; + } m_objectUpdated = false; } @@ -184,15 +188,7 @@ Object ( ); - void _InitValues() - { - m_uint32Values = new uint32[ m_valuesCount ]; - memset(m_uint32Values, 0, m_valuesCount*sizeof(uint32)); - - m_updateMask.SetCount(m_valuesCount); - ClearUpdateMask(); - } - + void _InitValues(); void _Create (uint32 guidlow, uint32 guidhigh); virtual void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; @@ -212,10 +208,10 @@ float *m_floatValues; }; + uint32 *m_uint32Values_mirror; + uint16 m_valuesCount; - UpdateMask m_updateMask; - bool m_inWorld; bool m_objectUpdated;