mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[10595] Add new functions to Set/RemoveShortFlag (uint16, lo and high part of uint32)
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
2fa5fa43bd
commit
926381824f
3 changed files with 42 additions and 1 deletions
|
|
@ -1072,6 +1072,44 @@ void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Object::SetShortFlag(uint16 index, bool highpart, uint16 newFlag)
|
||||||
|
{
|
||||||
|
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Object::RemoveShortFlag(uint16 index, bool highpart, uint16 oldFlag)
|
||||||
|
{
|
||||||
|
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Object::PrintIndexError(uint32 index, bool set) const
|
bool Object::PrintIndexError(uint32 index, bool set) const
|
||||||
{
|
{
|
||||||
sLog.outError("Attempt %s nonexistent value field: %u (count: %u) for object typeid: %u type mask: %u",(set ? "set value to" : "get value from"),index,m_valuesCount,GetTypeId(),m_objectType);
|
sLog.outError("Attempt %s nonexistent value field: %u (count: %u) for object typeid: %u type mask: %u",(set ? "set value to" : "get value from"),index,m_valuesCount,GetTypeId(),m_objectType);
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,9 @@ class MANGOS_DLL_SPEC Object
|
||||||
void SetByteFlag( uint16 index, uint8 offset, uint8 newFlag );
|
void SetByteFlag( uint16 index, uint8 offset, uint8 newFlag );
|
||||||
void RemoveByteFlag( uint16 index, uint8 offset, uint8 newFlag );
|
void RemoveByteFlag( uint16 index, uint8 offset, uint8 newFlag );
|
||||||
|
|
||||||
|
void SetShortFlag(uint16 index, bool highpart, uint16 newFlag);
|
||||||
|
void RemoveShortFlag(uint16 index, bool highpart, uint16 oldFlag);
|
||||||
|
|
||||||
void ToggleFlag( uint16 index, uint8 offset, uint8 flag )
|
void ToggleFlag( uint16 index, uint8 offset, uint8 flag )
|
||||||
{
|
{
|
||||||
if(HasByteFlag(index, offset, flag))
|
if(HasByteFlag(index, offset, flag))
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10594"
|
#define REVISION_NR "10595"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue