Core/Objects: Properly ASSERT when trying to access invalid updatefields

This commit is contained in:
Shauren authored and Ovahlord committed 2022-09-12 09:15:22 +02:00
1 parent 96c4a1b1f9
commit 54b65fc2ac
1 file changed
+5 -28
+5 -28
View File
@@ -895,12 +895,7 @@ void Object::SetFloatValue(uint16 index, float value)
void Object::SetByteValue(uint16 index, uint8 offset, uint8 value)
{
ASSERT(index < m_valuesCount || PrintIndexError(index, true));
if (offset > 3)
{
TC_LOG_ERROR("misc", "Object::SetByteValue: wrong offset %u", offset);
return;
}
ASSERT(offset < 4);
if (uint8(m_uint32Values[index] >> (offset * 8)) != value)
{
@@ -915,12 +910,7 @@ void Object::SetByteValue(uint16 index, uint8 offset, uint8 value)
void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
{
ASSERT(index < m_valuesCount || PrintIndexError(index, true));
if (offset > 1)
{
TC_LOG_ERROR("misc", "Object::SetUInt16Value: wrong offset %u", offset);
return;
}
ASSERT(offset < 2);
if (uint16(m_uint32Values[index] >> (offset * 16)) != value)
{
@@ -1011,7 +1001,6 @@ void Object::SetFlag(uint16 index, uint32 newFlag)
void Object::RemoveFlag(uint16 index, uint32 oldFlag)
{
ASSERT(index < m_valuesCount || PrintIndexError(index, true));
ASSERT(m_uint32Values);
uint32 oldval = m_uint32Values[index];
uint32 newval = oldval & ~oldFlag;
@@ -1035,9 +1024,7 @@ void Object::ToggleFlag(uint16 index, uint32 flag)
bool Object::HasFlag(uint16 index, uint32 flag) const
{
if (index >= m_valuesCount && !PrintIndexError(index, false))
return false;
ASSERT(index < m_valuesCount || PrintIndexError(index, true));
return (m_uint32Values[index] & flag) != 0;
}
@@ -1049,12 +1036,7 @@ void Object::ApplyModFlag(uint16 index, uint32 flag, bool apply)
void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
{
ASSERT(index < m_valuesCount || PrintIndexError(index, true));
if (offset > 3)
{
TC_LOG_ERROR("misc", "Object::SetByteFlag: wrong offset %u", offset);
return;
}
ASSERT(offset < 4);
if (!(uint8(m_uint32Values[index] >> (offset * 8)) & newFlag))
{
@@ -1068,12 +1050,7 @@ void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag)
{
ASSERT(index < m_valuesCount || PrintIndexError(index, true));
if (offset > 3)
{
TC_LOG_ERROR("misc", "Object::RemoveByteFlag: wrong offset %u", offset);
return;
}
ASSERT(offset < 4);
if (uint8(m_uint32Values[index] >> (offset * 8)) & oldFlag)
{