本文整理汇总了C++中NetBitStreamInterface::ReadBits方法的典型用法代码示例。如果您正苦于以下问题:C++ NetBitStreamInterface::ReadBits方法的具体用法?C++ NetBitStreamInterface::ReadBits怎么用?C++ NetBitStreamInterface::ReadBits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetBitStreamInterface
的用法示例。
在下文中一共展示了NetBitStreamInterface::ReadBits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
//
// Should do the same this as what CPedTaskPacket::Read() does
//
bool CSimPedTaskPacket::Read ( NetBitStreamInterface& BitStream )
{
// Read and save packet data
m_Cache.uiNumBitsInPacketBody = BitStream.GetNumberOfUnreadBits();
uint uiNumBytes = ( m_Cache.uiNumBitsInPacketBody + 1 ) / 8;
dassert( uiNumBytes < sizeof( m_Cache.DataBuffer ) );
if( uiNumBytes < sizeof( m_Cache.DataBuffer ) )
if ( BitStream.ReadBits( m_Cache.DataBuffer, m_Cache.uiNumBitsInPacketBody ) )
return true;
return false;
}
示例2: SetTrafficLightState
void CWorldRPCs::SetTrafficLightState(NetBitStreamInterface& bitStream)
{
char ucTrafficLightState;
if (bitStream.ReadBits(&ucTrafficLightState, 4))
{
bool bForced = bitStream.ReadBit();
// We ignore updating the serverside traffic light state if it's blocked, unless script forced it
if (bForced || !g_pMultiplayer->GetTrafficLightsLocked())
g_pMultiplayer->SetTrafficLightState((unsigned char)*&ucTrafficLightState);
}
}
示例3: Read
bool CVehicleInOutPacket::Read ( NetBitStreamInterface& BitStream )
{
// Read out the vehicle id
m_ID = INVALID_ELEMENT_ID;
BitStream.Read ( m_ID );
if ( m_ID == INVALID_ELEMENT_ID )
{
return false;
}
// Read out the action id
m_ucAction = 0xFF;
if ( !BitStream.ReadBits ( &m_ucAction, 4 ) )
return false;
// If the action is requesting to get in, read out the "passenger" flag too
if ( m_ucAction == CGame::VEHICLE_REQUEST_IN )
{
return BitStream.ReadBits ( &m_ucSeat, 3 ) &&
BitStream.ReadBit ( m_bOnWater ) &&
BitStream.ReadBits ( &m_ucDoor, 3 );
}
else if ( m_ucAction == CGame::VEHICLE_NOTIFY_JACK_ABORT )
{
SDoorOpenRatioSync door;
bool bStartedJacking;
if ( BitStream.ReadBits ( &m_ucDoor, 3 ) &&
BitStream.Read ( &door ) &&
BitStream.ReadBit ( bStartedJacking ) )
{
m_ucStartedJacking = bStartedJacking;
m_fDoorAngle = door.data.fRatio;
}
else
return false;
}
else if ( m_ucAction == CGame::VEHICLE_NOTIFY_IN_ABORT )
{
SDoorOpenRatioSync door;
if ( BitStream.ReadBits ( &m_ucDoor, 3 ) &&
BitStream.Read ( &door ) )
{
m_fDoorAngle = door.data.fRatio;
}
else
return false;
}
else if ( m_ucAction == CGame::VEHICLE_REQUEST_OUT )
{
m_ucDoor = 0;
if ( !BitStream.ReadBits ( &m_ucDoor, 2 ) )
m_ucDoor = 0xFF;
}
return true;
}