int ListCopy( CBaseEntity *pList[], int listMax ) { int count = MIN(listMax, ListCount()); for ( int i = 0; i < count; i++ ) { int entinfoIndex = m_simThinkList[i]; const CEntInfo *pInfo = gEntList.GetEntInfoPtrByIndex( entinfoIndex ); pList[i] = (CBaseEntity *)pInfo->m_pEntity; Assert( gEntList.IsEntityPtr( pList[i] ) ); } return count; }
int ListCopy( CBaseEntity *pList[], int listMax ) { int count = MIN(listMax, ListCount()); int out = 0; for ( int i = 0; i < count; i++ ) { // only copy out entities that will simulate or think this frame if ( m_simThinkList[i].nextThinkTick <= gpGlobals->tickcount ) { Assert(m_simThinkList[i].nextThinkTick>=0); int entinfoIndex = m_simThinkList[i].entEntry; const CEntInfo *pInfo = gEntList.GetEntInfoPtrByIndex( entinfoIndex ); pList[out] = (CBaseEntity *)pInfo->m_pEntity; Assert(m_simThinkList[i].nextThinkTick==0 || pList[out]->GetFirstThinkTick()==m_simThinkList[i].nextThinkTick); Assert( gEntList.IsEntityPtr( pList[out] ) ); out++; } } return out; }