diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 58f53c22a..d24404480 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -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 { 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); diff --git a/src/game/Object.h b/src/game/Object.h index f5088a3c2..58bee490d 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -225,6 +225,9 @@ class MANGOS_DLL_SPEC Object void SetByteFlag( 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 ) { if(HasByteFlag(index, offset, flag)) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index dee0eeec9..a50daf73a 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 "10594" + #define REVISION_NR "10595" #endif // __REVISION_NR_H__