本文整理汇总了C++中CUtlVector::FastRemove方法的典型用法代码示例。如果您正苦于以下问题:C++ CUtlVector::FastRemove方法的具体用法?C++ CUtlVector::FastRemove怎么用?C++ CUtlVector::FastRemove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtlVector
的用法示例。
在下文中一共展示了CUtlVector::FastRemove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveRenderable
void CClientLeafSystem::RemoveRenderable( ClientRenderHandle_t handle )
{
// This can happen upon level shutdown
if (!m_Renderables.IsValidIndex(handle))
return;
// Reset the render handle in the entity.
IClientRenderable *pRenderable = m_Renderables[handle].m_pRenderable;
Assert( handle == pRenderable->RenderHandle() );
pRenderable->RenderHandle() = INVALID_CLIENT_RENDER_HANDLE;
// Reemove the renderable from the dirty list
if ( m_Renderables[handle].m_Flags & RENDER_FLAGS_HASCHANGED )
{
// NOTE: This isn't particularly fast (linear search),
// but I'm assuming it's an unusual case where we remove
// renderables that are changing or that m_DirtyRenderables usually
// only has a couple entries
int i = m_DirtyRenderables.Find( handle );
Assert( i != m_DirtyRenderables.InvalidIndex() );
m_DirtyRenderables.FastRemove( i );
}
if ( IsViewModelRenderGroup( (RenderGroup_t)m_Renderables[handle].m_RenderGroup ) )
{
RemoveFromViewModelList( handle );
}
RemoveFromTree( handle );
m_Renderables.Remove( handle );
}
示例2: GoToMarketplaceForOffer
static void GoToMarketplaceForOffer()
{
#ifdef _X360
// Stop installing to the hard drive, otherwise STFC fragmentation hazard, as multiple non sequential HDD writes will occur.
// This needs to be done before the DLC might be downloaded to the HDD, otherwise it could be fragmented.
// We restart the installer on DLC download completion. We do not handle the cancel/abort case. The installer
// will restart through the pre-dlc path, i.e. after attract or exiting a map back to the main menu.
if ( g_pXboxInstaller )
g_pXboxInstaller->Stop();
// See if we need to free some of the queries
for ( int k = 0; k < g_arrMarketPlaceQueries.Count(); ++ k )
{
X360MarketPlaceQuery *pQuery = g_arrMarketPlaceQueries[k];
if ( XHasOverlappedIoCompleted( &pQuery->xOverlapped ) )
{
delete pQuery;
g_arrMarketPlaceQueries.FastRemove( k -- );
}
}
// Allocate a new query
X360MarketPlaceQuery *pQuery = new X360MarketPlaceQuery;
memset( pQuery, 0, sizeof( *pQuery ) );
pQuery->uiOfferID = g_MarketplaceEntryPoint.uiOfferID;
g_arrMarketPlaceQueries.AddToTail( pQuery );
// Open the marketplace entry point
int iSlot = CBaseModPanel::GetSingleton().GetLastActiveUserId();
int iCtrlr = XBX_GetUserIsGuest( iSlot ) ? XBX_GetPrimaryUserId() : XBX_GetUserId( iSlot );
xonline->XShowMarketplaceDownloadItemsUI( iCtrlr,
g_MarketplaceEntryPoint.dwEntryPoint, &pQuery->uiOfferID, 1,
&pQuery->hResult, &pQuery->xOverlapped );
#endif
}
示例3: OnPreQuery
//-----------------------------------------------------------------------------
// Makes sure all entries in the KD tree are in the correct position
//-----------------------------------------------------------------------------
void CDirtySpatialPartitionEntityList::OnPreQuery( SpatialPartitionListMask_t listMask )
{
#ifdef CLIENT_DLL
if ( !( listMask & PARTITION_CLIENT_GAME_EDICTS ) )
return;
// FIXME: This should really be an assertion... feh!
if ( !C_BaseEntity::IsAbsRecomputationsEnabled() )
{
m_mutex.Lock();
return;
}
#else
if ( !( listMask & PARTITION_SERVER_GAME_EDICTS ) )
return;
#endif
m_mutex.Lock();
CUtlVector< CBaseHandle > vecStillDirty;
int nDirtyEntityCount = m_DirtyEntities.Count();
while ( nDirtyEntityCount > 0 )
{
CBaseHandle handle;
handle = m_DirtyEntities[nDirtyEntityCount-1];
#ifndef CLIENT_DLL
CBaseEntity *pEntity = gEntList.GetBaseEntity( handle );
#else
CBaseEntity *pEntity = cl_entitylist->GetBaseEntityFromHandle( handle );
#endif
m_DirtyEntities.FastRemove( nDirtyEntityCount-1 );
if ( pEntity )
{
// If an entity is in the middle of bone setup, don't call UpdatePartition
// which can cause it to redo bone setup on the same frame causing a recursive
// call to bone setup.
if ( !pEntity->IsEFlagSet( EFL_SETTING_UP_BONES ) )
{
pEntity->CollisionProp()->UpdatePartition();
}
else
{
vecStillDirty.AddToTail( handle );
}
}
nDirtyEntityCount = m_DirtyEntities.Count();
}
if ( vecStillDirty.Count() > 0 )
{
m_DirtyEntities = vecStillDirty;
}
}
示例4:
void CSecobModportal1List::RemoveFromList( CNPC_SecobModportal1 *pSecobModportal1 )
{
int index = m_list.Find( pSecobModportal1 );
if ( index != m_list.InvalidIndex() )
{
m_list.FastRemove( index );
}
}
示例5: RemoveFromList
void CBullseyeList::RemoveFromList( CNPC_Bullseye *pBullseye )
{
int index = m_list.Find( pBullseye );
if ( index != m_list.InvalidIndex() )
{
m_list.FastRemove( index );
}
}
示例6:
CModelLookupContext::~CModelLookupContext()
{
if ( m_lookupIndex >= 0 )
{
Assert(m_lookupIndex == (g_ModelLookup.Count()-1));
g_ModelLookup.FastRemove(m_lookupIndex);
g_ModelLookupIndex = g_ModelLookup.Count()-1;
}
}
示例7: UpdateFluidEvents
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCollisionEvent::UpdateFluidEvents( void )
{
for ( int i = m_fluidEvents.Count()-1; i >= 0; --i )
{
if ( (gpGlobals->curtime - m_fluidEvents[i].impactTime) > FLUID_TIME_MAX )
{
m_fluidEvents.FastRemove(i);
}
}
}
示例8: RemoveEntity
// Remove noitfication for an entity
void CNotifyList::RemoveEntity( CBaseEntity *pNotify, CBaseEntity *pWatched )
{
for ( int i = m_notifyList.Count(); --i >= 0; )
{
if ( m_notifyList[i].pNotify == pNotify && m_notifyList[i].pWatched == pWatched)
{
m_notifyList.FastRemove(i);
}
}
}
示例9: ClearEntity
// UNDONE: Slow linear search?
void CNotifyList::ClearEntity( CBaseEntity *pNotify )
{
for ( int i = m_notifyList.Count(); --i >= 0; )
{
if ( m_notifyList[i].pNotify == pNotify || m_notifyList[i].pWatched == pNotify)
{
m_notifyList.FastRemove(i);
}
}
}
示例10: RemoveGroup
void CAI_FollowManager::RemoveGroup( AI_FollowGroup_t *pGroup )
{
for ( int i = 0; i < m_groups.Count(); i++ )
{
if ( m_groups[i] == pGroup )
{
delete m_groups[i];
m_groups.FastRemove(i);
return;
}
}
}
示例11: UpdatePenetrateEvents
// NOTE: This assumes entity pointers are sorted to simplify search!
void CCollisionEvent::UpdatePenetrateEvents()
{
const float MAX_PENETRATION_TIME = 3.0f;
for ( int i = m_penetrateEvents.Count()-1; i >= 0; --i )
{
float timeSincePenetration = gpGlobals->curtime - m_penetrateEvents[i].timeStamp;
if ( timeSincePenetration > 0.1f )
{
m_penetrateEvents.FastRemove(i);
continue;
}
float timeInPenetration = m_penetrateEvents[i].timeStamp - m_penetrateEvents[i].startTime;
// it's been too long, just give up and disable collisions
if ( timeInPenetration > MAX_PENETRATION_TIME )
{
PhysDisableEntityCollisions( m_penetrateEvents[i].pEntity0, m_penetrateEvents[i].pEntity1 );
m_penetrateEvents.FastRemove(i);
continue;
}
}
}
示例12: CompressAmbientSampleList
// this samples the lighting at each sample and removes any unnecessary samples
void CompressAmbientSampleList( CUtlVector<ambientsample_t> &list )
{
Vector testCube[6];
for ( int i = 0; i < list.Count(); i++ )
{
if ( list.Count() > 1 )
{
Mod_LeafAmbientColorAtPos( testCube, list[i].pos, list, i );
if ( CubeDeltaGammaSpace(testCube, list[i].cube) < 3 )
{
list.FastRemove(i);
i--;
}
}
}
}
示例13: Update
void Update()
{
if ( tickCount > gpGlobals->tickcount )
{
list.RemoveAll();
return;
}
for ( int i = list.Count()-1; i >= 0; --i )
{
if ( list[i].tickCount != gpGlobals->tickcount )
{
list.FastRemove(i);
}
}
}
示例14: AreThereLightSourcesWithinRadius
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CDarknessLightSourcesSystem::AreThereLightSourcesWithinRadius( CBaseEntity *pLooker, float flRadius )
{
float flRadiusSqr = (flRadius * flRadius);
for ( int i = m_LightSources.Count() - 1; i >= 0; i-- )
{
// Removed?
if ( m_LightSources[i].hEntity == NULL || m_LightSources[i].hEntity->IsMarkedForDeletion() )
{
m_LightSources.FastRemove( i );
continue;
}
CBaseEntity *pLightSource = m_LightSources[i].hEntity;
// Close enough to a light source?
float flDistanceSqr = (pLooker->WorldSpaceCenter() - pLightSource->GetAbsOrigin()).LengthSqr();
if ( flDistanceSqr < flRadiusSqr )
{
trace_t tr;
AI_TraceLine( pLooker->EyePosition(), pLightSource->GetAbsOrigin(), MASK_SOLID_BRUSHONLY, pLooker, COLLISION_GROUP_NONE, &tr );
if ( g_debug_darkness.GetBool() )
{
if (tr.fraction != 1.0)
{
NDebugOverlay::Line( pLooker->WorldSpaceCenter(), tr.endpos, 255,0,0,true, 0.1);
}
else
{
NDebugOverlay::Line( pLooker->WorldSpaceCenter(), tr.endpos, 0,255,0,true, 0.1);
NDebugOverlay::Line( pLightSource->GetAbsOrigin(), tr.endpos, 255,0,0,true, 0.1);
}
}
if ( tr.fraction == 1.0 )
return true;
}
}
return false;
}
示例15: Execute
void CTilegenAction_FilterCandidatesByDirection::Execute( CLayoutSystem *pLayoutSystem )
{
CUtlVector< CRoomCandidate > *pRoomCandidateList = pLayoutSystem->GetRoomCandidateList();
if ( pRoomCandidateList->Count() == 0 )
{
return;
}
const char *pDirection = m_pDirectionExpression->Evaluate( pLayoutSystem->GetFreeVariables() );
int nThreshold = m_pThresholdExpression->Evaluate( pLayoutSystem->GetFreeVariables() );
nThreshold = MAX( 0, nThreshold );
ExitDirection_t direction = GetDirectionFromString( pDirection );
if ( direction < EXITDIR_BEGIN || direction >= EXITDIR_END )
{
Log_Warning( LOG_TilegenLayoutSystem, "Invalid direction specified: %s.\n", pDirection );
return;
}
// First go through and figure out the highest score
int nHighScore = INT_MIN;
for ( int i = 0; i < pRoomCandidateList->Count(); ++ i )
{
const CRoomCandidate *pCandidate = &pRoomCandidateList->Element( i );
int nScore = ComputeScore( direction, pCandidate->m_iXPos, pCandidate->m_iYPos );
if ( nScore > nHighScore )
{
nHighScore = nScore;
}
}
// Now go through and set the chance of each candidate to 1.0f for any with that score or 0.0f for those with a lower score
// @TODO: allow for specifying a numerical range in which candidates are chosen
for ( int i = pRoomCandidateList->Count() - 1; i >= 0; -- i )
{
const CRoomCandidate *pCandidate = &pRoomCandidateList->Element( i );
if ( ComputeScore( direction, pCandidate->m_iXPos, pCandidate->m_iYPos ) < ( nHighScore - nThreshold ) )
{
pRoomCandidateList->FastRemove( i );
}
}
}