mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[11027] Move repeatable code to Object::MarkForClientUpdate()
This function can be used for cases when need sedn object update for dynamic flags update.
This commit is contained in:
parent
5099b9133c
commit
d0e2c2e9af
3 changed files with 26 additions and 109 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11026"
|
||||
#define REVISION_NR "11027"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue