Esempio n. 1
0
void CRadarArea::SetPosition ( const CVector& vecPosition )
{
    // Remember the last position
    m_vecLastPosition = m_vecPosition;

    // Different from our current position?
    if ( vecPosition != m_vecPosition )
    {
        // Set the new position
        m_vecPosition = vecPosition;

        // We need to make sure the time context is replaced 
        // before that so old packets don't arrive after this.
        GenerateSyncTimeContext ();

        // Tell all the players that know about us
        CBitStream BitStream;
        BitStream.pBitStream->Write ( m_ID );
        BitStream.pBitStream->Write ( vecPosition.fX );
        BitStream.pBitStream->Write ( vecPosition.fY );
        BitStream.pBitStream->Write ( vecPosition.fZ );
        BitStream.pBitStream->Write ( GetSyncTimeContext () );
        BroadcastOnlyVisible ( CLuaPacket ( SET_ELEMENT_POSITION, *BitStream.pBitStream ) );
    }
}
Esempio n. 2
0
void CMarker::SetPosition ( const CVector& vecPosition )
{
    // Different from our current position?
    if ( m_vecPosition != vecPosition )
    {
        // Set the new position
        m_vecPosition = vecPosition;
        if ( m_pCollision )
            m_pCollision->SetPosition ( vecPosition );
        UpdateSpatialData ();

        // If attached, client should handle the position correctly
        if (  m_pAttachedTo )
            return;

        // We need to make sure the time context is replaced 
        // before that so old packets don't arrive after this.
        GenerateSyncTimeContext ();

        // Tell all the players that know about us
        CBitStream BitStream;
        BitStream.pBitStream->Write ( vecPosition.fX );
        BitStream.pBitStream->Write ( vecPosition.fY );
        BitStream.pBitStream->Write ( vecPosition.fZ );
        BitStream.pBitStream->Write ( GetSyncTimeContext () );
        BroadcastOnlyVisible ( CElementRPCPacket ( this, SET_ELEMENT_POSITION, *BitStream.pBitStream ) );
    }
}