コード例 #1
0
void CClientObjectManager::RestreamObjects ( unsigned short usModel )
{
    for ( uint i = 0 ; i < m_Objects.size() ; i++ )
    {
        CClientObject* pObject = m_Objects[i];

        // Streamed in and same model ID?
        if ( pObject->IsStreamedIn () && pObject->GetModel () == usModel )
        {
            // Stream it out for a while until streamed decides to stream it
            // back in eventually
            pObject->StreamOutForABit ();
        }
    }
}
コード例 #2
0
void CObjectRespawner::DoRespawnAll()
{
    for (uint i = 0; i < m_List.size(); i++)
    {
        CClientObject* pObject = m_List[i];

        // Only recreate if we're still valid and streamed in
        if (pObject && !pObject->IsBeingDeleted() && pObject->IsStreamedIn())
        {
            pObject->ReCreate();
            pObject->SetBeingRespawned(false);
        }
    }

    m_List.clear();
}
コード例 #3
0
void CClientObjectManager::RestreamObjects ( unsigned short usModel )
{
    // Store the affected vehicles
    CClientObject* pObject;
    std::list < CClientObject* > ::const_iterator iter = IterBegin ();
    for ( ; iter != IterEnd (); iter++ )
    {
        pObject = *iter;

        // Streamed in and same vehicle ID?
        if ( pObject->IsStreamedIn () && pObject->GetModel () == usModel )
        {
            // Stream it out for a while until streamed decides to stream it
            // back in eventually
            pObject->StreamOutForABit ();
        }
    }
}
コード例 #4
0
bool CClientObjectManager::ObjectsAroundPointLoaded ( const CVector& vecPosition, float fRadius, unsigned short usDimension, SString* pstrStatus )
{
    // Get list of objects that may be intersecting the sphere
    CClientEntityResult result;
    GetClientSpatialDatabase()->SphereQuery ( result, CSphere ( vecPosition, fRadius ) );

    bool bResult = true;
    // Extract relevant types
    for ( CClientEntityResult::const_iterator it = result.begin () ; it != result.end (); ++it )
    {
        CClientEntity* pEntity = *it;
        if  ( pEntity->GetType () == CCLIENTOBJECT )
        {
            CClientObject* pObject = static_cast < CClientObject* > ( pEntity );
            if ( !pObject->GetGameObject () || !pObject->GetModelInfo ()->IsLoaded () || !pObject->IsStreamedIn () )
            {
                if ( pObject->GetDimension () == usDimension )
                {
                    // Final distance check
                    float fDistSquared = pObject->GetDistanceToBoundingBoxSquared ( vecPosition );
                    if ( fDistSquared < fRadius * fRadius )
                        bResult = false;

                    if ( pstrStatus )
                    {
                        // Debugging information
                        *pstrStatus += SString ( "ID:%05d  Dist:%4.1f  GetGameObject:%d  IsLoaded:%d  IsStreamedIn:%d\n"
                                                ,pObject->GetModel ()
                                                ,sqrtf ( fDistSquared )
                                                ,pObject->GetGameObject () ? 1 : 0
                                                ,pObject->GetModelInfo ()->IsLoaded () ? 1 : 0
                                                ,pObject->IsStreamedIn () ? 1 : 0
                                              );
                    }
                    else
                    if ( !bResult )
                        break;
                }
            }
        }
    }

    return bResult;
}