aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-12 11:21:28 -0600
committermegamage <none@none>2008-12-12 11:21:28 -0600
commitb6c288ca9fb271923f493ee39d78b5dc4b2a996f (patch)
treeec03c0dce11277c5e04f87a33ca76f1dd78687e7 /src/game/Object.cpp
parent135f39a5efabc12728924933056f3ea952dd2c09 (diff)
*Update to Mangos 6902. Source: Mangos.
*Skipped rev: rev 6893, some code about waypoint movement. --HG-- branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp62
1 files changed, 56 insertions, 6 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 2872f29cdaf..6ecf241dfa2 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -378,12 +378,12 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2
*data << ((Unit*)this)->GetSpeed( MOVE_WALK );
*data << ((Unit*)this)->GetSpeed( MOVE_RUN );
- *data << ((Unit*)this)->GetSpeed( MOVE_SWIMBACK );
+ *data << ((Unit*)this)->GetSpeed( MOVE_SWIM_BACK );
*data << ((Unit*)this)->GetSpeed( MOVE_SWIM );
- *data << ((Unit*)this)->GetSpeed( MOVE_WALKBACK );
- *data << ((Unit*)this)->GetSpeed( MOVE_FLY );
- *data << ((Unit*)this)->GetSpeed( MOVE_FLYBACK );
- *data << ((Unit*)this)->GetSpeed( MOVE_TURN );
+ *data << ((Unit*)this)->GetSpeed( MOVE_RUN_BACK );
+ *data << ((Unit*)this)->GetSpeed( MOVE_FLIGHT );
+ *data << ((Unit*)this)->GetSpeed( MOVE_FLIGHT_BACK );
+ *data << ((Unit*)this)->GetSpeed( MOVE_TURN_RATE );
// 0x08000000
if(flags2 & MOVEMENTFLAG_SPLINE2)
@@ -654,7 +654,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
*data << uint32(1);
break;
default:
- *data << uint32(0); //unknown. not happen.
+ *data << uint32(0); // unknown. not happen.
break;
}
}
@@ -963,6 +963,56 @@ void Object::RemoveFlag( uint16 index, uint32 oldFlag )
}
}
+void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag )
+{
+ ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+
+ if(offset > 4)
+ {
+ sLog.outError("Object::SetByteFlag: wrong offset %u", offset);
+ return;
+ }
+
+ if(!(uint8(m_uint32Values[ index ] >> (offset * 8)) & newFlag))
+ {
+ m_uint32Values[ index ] |= uint32(uint32(newFlag) << (offset * 8));
+
+ if(m_inWorld)
+ {
+ if(!m_objectUpdated)
+ {
+ ObjectAccessor::Instance().AddUpdateObject(this);
+ m_objectUpdated = true;
+ }
+ }
+ }
+}
+
+void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag )
+{
+ ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+
+ if(offset > 4)
+ {
+ sLog.outError("Object::RemoveByteFlag: wrong offset %u", offset);
+ return;
+ }
+
+ if(uint8(m_uint32Values[ index ] >> (offset * 8)) & oldFlag)
+ {
+ m_uint32Values[ index ] &= ~uint32(uint32(oldFlag) << (offset * 8));
+
+ if(m_inWorld)
+ {
+ if(!m_objectUpdated)
+ {
+ ObjectAccessor::Instance().AddUpdateObject(this);
+ m_objectUpdated = true;
+ }
+ }
+ }
+}
+
bool Object::PrintIndexError(uint32 index, bool set) const
{
sLog.outError("ERROR: Attempt %s non-existed 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);