本文整理汇总了C++中CClientVehicle::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientVehicle::GetID方法的具体用法?C++ CClientVehicle::GetID怎么用?C++ CClientVehicle::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClientVehicle
的用法示例。
在下文中一共展示了CClientVehicle::GetID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteVehicleInformation
bool CUnoccupiedVehicleSync::WriteVehicleInformation ( NetBitStreamInterface* pBitStream, CDeathmatchVehicle* pVehicle )
{
bool bSyncVehicle = false;
SUnoccupiedVehicleSync vehicle;
// Copy the vehicle data into the sync structures
vehicle.data.vehicleID = pVehicle->GetID ();
vehicle.data.ucTimeContext = pVehicle->GetSyncTimeContext ();
pVehicle->GetPosition ( vehicle.data.vecPosition );
pVehicle->GetRotationDegrees ( vehicle.data.vecRotation );
if ( pVehicle->GetGameVehicle () )
{
pVehicle->GetMoveSpeed ( vehicle.data.vecVelocity );
pVehicle->GetTurnSpeed ( vehicle.data.vecTurnVelocity );
}
vehicle.data.fHealth = pVehicle->GetHealth ();
CClientVehicle* pTrailer = pVehicle->GetRealTowedVehicle ();
if ( pTrailer )
vehicle.data.trailer = pTrailer->GetID ();
else
vehicle.data.trailer = static_cast < ElementID > ( INVALID_ELEMENT_ID );
// Adjust the sync flags
if ( pVehicle->GetModelInfo ()->IsBoat () )
{
// Boats vary their z height a bit when on water due to the wave effect
// It's not needed to sync these tiny changes.
const CVector& vecLastPosition = pVehicle->m_LastSyncedData->vecPosition;
if ( fabs ( vecLastPosition.fX - vehicle.data.vecPosition.fX ) > FLOAT_EPSILON ||
fabs ( vecLastPosition.fY - vehicle.data.vecPosition.fY ) > FLOAT_EPSILON ||
fabs ( vecLastPosition.fZ - vehicle.data.vecPosition.fZ ) > 1.2f )
{
bSyncVehicle = true;
vehicle.data.bSyncPosition = true;
pVehicle->m_LastSyncedData->vecPosition = vehicle.data.vecPosition;
}
const CVector& vecLastVelocity = pVehicle->m_LastSyncedData->vecMoveSpeed;
if ( vecLastVelocity != vehicle.data.vecVelocity &&
(
fabs ( vehicle.data.vecVelocity.fX ) > FLOAT_EPSILON ||
fabs ( vehicle.data.vecVelocity.fY ) > FLOAT_EPSILON ||
fabs ( vehicle.data.vecVelocity.fZ ) > FLOAT_EPSILON
)
)
{
bSyncVehicle = true;
vehicle.data.bSyncVelocity = true;
pVehicle->m_LastSyncedData->vecMoveSpeed = vehicle.data.vecVelocity;
}
}
else
{
if ( pVehicle->m_LastSyncedData->vecPosition != vehicle.data.vecPosition )
{
bSyncVehicle = true;
vehicle.data.bSyncPosition = true;
pVehicle->m_LastSyncedData->vecPosition = vehicle.data.vecPosition;
}
if ( pVehicle->m_LastSyncedData->vecMoveSpeed != vehicle.data.vecVelocity )
{
bSyncVehicle = true;
vehicle.data.bSyncVelocity = true;
pVehicle->m_LastSyncedData->vecMoveSpeed = vehicle.data.vecVelocity;
}
}
if ( pVehicle->m_LastSyncedData->vecRotation != vehicle.data.vecRotation )
{
bSyncVehicle = true;
vehicle.data.bSyncRotation = true;
pVehicle->m_LastSyncedData->vecRotation = vehicle.data.vecRotation;
}
if ( pVehicle->m_LastSyncedData->vecTurnSpeed != vehicle.data.vecTurnVelocity )
{
bSyncVehicle = true;
vehicle.data.bSyncTurnVelocity = true;
pVehicle->m_LastSyncedData->vecTurnSpeed = vehicle.data.vecTurnVelocity;
}
if ( fabs ( pVehicle->m_LastSyncedData->fHealth - vehicle.data.fHealth ) > FLOAT_EPSILON )
{
bSyncVehicle = true;
vehicle.data.bSyncHealth = true;
pVehicle->m_LastSyncedData->fHealth = vehicle.data.fHealth;
}
if ( pVehicle->m_LastSyncedData->Trailer != vehicle.data.trailer )
{
bSyncVehicle = true;
vehicle.data.bSyncTrailer = true;
pVehicle->m_LastSyncedData->Trailer = vehicle.data.trailer;
}
//.........这里部分代码省略.........