diff --git a/src/game/Object.cpp b/src/game/Object.cpp index a5d35a71b..4c38ea27d 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -781,15 +781,7 @@ void Object::SetInt32Value( uint16 index, int32 value ) if(m_int32Values[ index ] != value) { m_int32Values[ index ] = value; - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -800,15 +792,7 @@ void Object::SetUInt32Value( uint16 index, uint32 value ) if(m_uint32Values[ index ] != value) { m_uint32Values[ index ] = value; - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -819,15 +803,7 @@ void Object::SetUInt64Value( uint16 index, const uint64 &value ) { m_uint32Values[ index ] = *((uint32*)&value); m_uint32Values[ index + 1 ] = *(((uint32*)&value) + 1); - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -838,15 +814,7 @@ void Object::SetFloatValue( uint16 index, float value ) if(m_floatValues[ index ] != value) { m_floatValues[ index ] = value; - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -864,15 +832,7 @@ void Object::SetByteValue( uint16 index, uint8 offset, uint8 value ) { m_uint32Values[ index ] &= ~uint32(uint32(0xFF) << (offset * 8)); m_uint32Values[ index ] |= uint32(uint32(value) << (offset * 8)); - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -890,15 +850,7 @@ void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value ) { m_uint32Values[ index ] &= ~uint32(uint32(0xFFFF) << (offset * 16)); m_uint32Values[ index ] |= uint32(uint32(value) << (offset * 16)); - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -959,15 +911,7 @@ void Object::SetFlag( uint16 index, uint32 newFlag ) if(oldval != newval) { m_uint32Values[ index ] = newval; - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -980,15 +924,7 @@ void Object::RemoveFlag( uint16 index, uint32 oldFlag ) if(oldval != newval) { m_uint32Values[ index ] = newval; - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -1005,15 +941,7 @@ void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ) if(!(uint8(m_uint32Values[ index ] >> (offset * 8)) & newFlag)) { m_uint32Values[ index ] |= uint32(uint32(newFlag) << (offset * 8)); - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -1030,15 +958,7 @@ void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag ) if(uint8(m_uint32Values[ index ] >> (offset * 8)) & oldFlag) { m_uint32Values[ index ] &= ~uint32(uint32(oldFlag) << (offset * 8)); - - if(m_inWorld) - { - if(!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -1049,15 +969,7 @@ void Object::SetShortFlag(uint16 index, bool highpart, uint16 newFlag) if (!(uint16(m_uint32Values[index] >> (highpart ? 16 : 0)) & newFlag)) { m_uint32Values[index] |= uint32(uint32(newFlag) << (highpart ? 16 : 0)); - - if (m_inWorld) - { - if (!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -1068,15 +980,7 @@ void Object::RemoveShortFlag(uint16 index, bool highpart, uint16 oldFlag) if (uint16(m_uint32Values[index] >> (highpart ? 16 : 0)) & oldFlag) { m_uint32Values[index] &= ~uint32(uint32(oldFlag) << (highpart ? 16 : 0)); - - if (m_inWorld) - { - if (!m_objectUpdated) - { - AddToClientUpdateList(); - m_objectUpdated = true; - } - } + MarkForClientUpdate(); } } @@ -1120,6 +1024,18 @@ void Object::BuildUpdateData( UpdateDataMapType& /*update_players */) MANGOS_ASSERT(false); } +void Object::MarkForClientUpdate() +{ + if(m_inWorld) + { + if(!m_objectUpdated) + { + AddToClientUpdateList(); + m_objectUpdated = true; + } + } +} + WorldObject::WorldObject() : m_isActiveObject(false), m_currMap(NULL), m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f) diff --git a/src/game/Object.h b/src/game/Object.h index 0683d47f0..86f48907e 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -157,6 +157,7 @@ class MANGOS_DLL_SPEC Object virtual void AddToClientUpdateList(); virtual void RemoveFromClientUpdateList(); virtual void BuildUpdateData(UpdateDataMapType& update_players); + void MarkForClientUpdate(); void BuildValuesUpdateBlockForPlayer( UpdateData *data, Player *target ) const; void BuildOutOfRangeUpdateBlock( UpdateData *data ) const; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b5ea992b6..0e4cf4332 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 "11026" + #define REVISION_NR "11027" #endif // __REVISION_NR_H__