*Update to Mangos 6902. Source: Mangos.

*Skipped rev: rev 6893, some code about waypoint movement.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-12 11:21:28 -06:00
parent 135f39a5ef
commit b6c288ca9f
84 changed files with 785 additions and 705 deletions

View File

@@ -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);