本文整理汇总了C++中CVehicle::GetCollisionEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ CVehicle::GetCollisionEnabled方法的具体用法?C++ CVehicle::GetCollisionEnabled怎么用?C++ CVehicle::GetCollisionEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVehicle
的用法示例。
在下文中一共展示了CVehicle::GetCollisionEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
bool CEntityAddPacket::Write ( NetBitStreamInterface& BitStream ) const
{
SPositionSync position ( false );
// Check that we have any entities
if ( m_Entities.size () > 0 )
{
// Write the number of entities
unsigned int NumElements = m_Entities.size ();
BitStream.WriteCompressed ( NumElements );
// For each entity ...
CVector vecTemp;
vector < CElement* > ::const_iterator iter = m_Entities.begin ();
for ( ; iter != m_Entities.end (); iter++ )
{
// Entity id
CElement* pElement = *iter;
BitStream.Write ( pElement->GetID () );
// Entity type id
unsigned char ucEntityTypeID = static_cast < unsigned char > ( pElement->GetType () );
BitStream.Write ( ucEntityTypeID );
// Entity parent
CElement* pParent = pElement->GetParentEntity ();
ElementID ParentID = INVALID_ELEMENT_ID;
if ( pParent )
ParentID = pParent->GetID ();
BitStream.Write ( ParentID );
// Entity interior
BitStream.Write ( pElement->GetInterior () );
// Entity dimension
BitStream.WriteCompressed ( pElement->GetDimension () );
// Entity attached to
CElement* pElementAttachedTo = pElement->GetAttachedToElement ();
if ( pElementAttachedTo )
{
BitStream.WriteBit ( true );
BitStream.Write ( pElementAttachedTo->GetID () );
// Attached position and rotation
SPositionSync attachedPosition ( false );
SRotationDegreesSync attachedRotation ( false );
pElement->GetAttachedOffsets ( attachedPosition.data.vecPosition,
attachedRotation.data.vecRotation );
BitStream.Write ( &attachedPosition );
BitStream.Write ( &attachedRotation );
}
else
BitStream.WriteBit ( false );
// Entity collisions enabled
bool bCollisionsEnabled = true;
switch ( pElement->GetType() )
{
case CElement::VEHICLE:
{
CVehicle* pVehicle = static_cast < CVehicle* > ( pElement );
bCollisionsEnabled = pVehicle->GetCollisionEnabled ( );
break;
}
case CElement::OBJECT:
{
CObject* pObject = static_cast < CObject* > ( pElement );
bCollisionsEnabled = pObject->GetCollisionEnabled ( );
break;
}
case CElement::PED:
case CElement::PLAYER:
{
CPed* pPed = static_cast < CPed* > ( pElement );
bCollisionsEnabled = pPed->GetCollisionEnabled ( );
break;
}
}
BitStream.WriteBit ( bCollisionsEnabled );
// Write custom data
CCustomData* pCustomData = pElement->GetCustomDataPointer ();
assert ( pCustomData );
BitStream.WriteCompressed ( pCustomData->CountOnlySynchronized () );
map < string, SCustomData > :: const_iterator iter = pCustomData->IterBegin ();
for ( ; iter != pCustomData->IterEnd (); iter++ )
{
const char* szName = iter->first.c_str ();
const CLuaArgument* pArgument = &iter->second.Variable;
bool bSynchronized = iter->second.bSynchronized;
if ( bSynchronized )
{
unsigned char ucNameLength = static_cast < unsigned char > ( strlen ( szName ) );
BitStream.Write ( ucNameLength );
BitStream.Write ( szName, ucNameLength );
pArgument->WriteToBitStream ( BitStream );
//.........这里部分代码省略.........