Esempio n. 1
0
void CClientEntity::GetEntitiesFromRoot ( unsigned int uiTypeHash, CLuaMain* pLuaMain, bool bStreamedIn )
{
#if CHECK_ENTITIES_FROM_ROOT
    _CheckEntitiesFromRoot ( uiTypeHash );
#endif

    t_mapEntitiesFromRoot::iterator find = ms_mapEntitiesFromRoot.find ( uiTypeHash );
    if ( find != ms_mapEntitiesFromRoot.end () )
    {
        std::list < CClientEntity* >& listEntities = find->second;
        CClientEntity* pEntity;
        lua_State* luaVM = pLuaMain->GetVirtualMachine ();
        unsigned int uiIndex = 0;

        for ( std::list < CClientEntity* >::const_reverse_iterator i = listEntities.rbegin ();
              i != listEntities.rend ();
              ++i )
        {
            pEntity = *i;

            // Only streamed in elements?
            if ( !bStreamedIn || !pEntity->IsStreamingCompatibleClass() || 
                 reinterpret_cast < CClientStreamElement* > ( pEntity )->IsStreamedIn() )
            {
                // Add it to the table
                lua_pushnumber ( luaVM, ++uiIndex );
                lua_pushelement ( luaVM, pEntity );
                lua_settable ( luaVM, -3 );
            }
        }
    }    
}
Esempio n. 2
0
void CClientEntity::GetEntitiesFromRoot ( unsigned int uiTypeHash, lua_State* luaVM, bool bStreamedIn )
{
#if CHECK_ENTITIES_FROM_ROOT
    _CheckEntitiesFromRoot ( uiTypeHash );
#endif

    t_mapEntitiesFromRoot::iterator find = ms_mapEntitiesFromRoot.find ( uiTypeHash );
    if ( find != ms_mapEntitiesFromRoot.end () )
    {
        CFromRootListType& listEntities = find->second;
        CClientEntity* pEntity;
        unsigned int uiIndex = 0;

        for ( CFromRootListType::reverse_iterator i = listEntities.rbegin ();
              i != listEntities.rend ();
              ++i )
        {
            pEntity = *i;

            // Only streamed in elements?
            if ( !bStreamedIn || !pEntity->IsStreamingCompatibleClass() || 
                 reinterpret_cast < CClientStreamElement* > ( pEntity )->IsStreamedIn() )
            {
                // Add it to the table
                lua_pushnumber ( luaVM, ++uiIndex );
                pEntity->PushStack( luaVM );
                lua_settable ( luaVM, -3 );
            }
        }
    }    
}