本文整理汇总了C++中CUtlVector::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ CUtlVector::Find方法的具体用法?C++ CUtlVector::Find怎么用?C++ CUtlVector::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtlVector
的用法示例。
在下文中一共展示了CUtlVector::Find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindNearbyDismountPoints
//-----------------------------------------------------------------------------
// Purpose:
// Input : origin -
// radius -
// list -
//-----------------------------------------------------------------------------
void CFuncLadder::FindNearbyDismountPoints( const Vector& origin, float radius, CUtlVector< CInfoLadderDismountHandle >& list )
{
#if !defined( CLIENT_DLL )
CBaseEntity *pEntity = NULL;
while ( (pEntity = gEntList.FindEntityByClassnameWithin( pEntity, "info_ladder_dismount", origin, radius)) != NULL )
{
CInfoLadderDismount *landingspot = static_cast< CInfoLadderDismount * >( pEntity );
Assert( landingspot );
// If spot has a target, then if the target is not this ladder, don't add to our list.
if ( landingspot->m_target != NULL_STRING )
{
if ( landingspot->GetNextTarget() != this )
{
continue;
}
}
CInfoLadderDismountHandle handle;
handle = landingspot;
if ( list.Find( handle ) == list.InvalidIndex() )
{
list.AddToTail( handle );
}
}
#endif
}
示例2: InputTurnOn
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPointPlayerMoveConstraint::InputTurnOn( inputdata_t &inputdata )
{
// Find all players within our radius and constraint them
float flRadius = m_flRadius;
// If we're in singleplayer, blow the radius a bunch
if ( gpGlobals->maxClients == 1 )
{
flRadius = MAX_COORD_RANGE;
}
CBaseEntity *pEntity = NULL;
while ( (pEntity = gEntList.FindEntityByClassnameWithin( pEntity, "player", GetLocalOrigin(), flRadius)) != NULL )
{
CBasePlayer *pPlayer = ToBasePlayer( pEntity );
Assert( pPlayer );
// Only add him if he's not already constrained
if ( m_hConstrainedPlayers.Find( pPlayer ) == m_hConstrainedPlayers.InvalidIndex() )
{
m_hConstrainedPlayers.AddToTail( pPlayer );
pPlayer->ActivateMovementConstraint( this, GetAbsOrigin(), m_flRadius, m_flConstraintWidth, m_flSpeedFactor );
}
}
// Only think if we found any
if ( m_hConstrainedPlayers.Count() )
{
SetThink( &CPointPlayerMoveConstraint::ConstraintThink );
SetNextThink( gpGlobals->curtime + 0.1f );
}
}
示例3: Add
void CBuildModeDialogMgr::Add( BuildModeDialog *pDlg )
{
if ( m_vecBuildDialogs.Find( pDlg ) == m_vecBuildDialogs.InvalidIndex() )
{
m_vecBuildDialogs.AddToTail( pDlg );
}
}
示例4: 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 );
}
示例5: HasWeapon
//-----------------------------------------------------------------------------
// Purpose: Checks to see if a weapon is already known
// Input : *pWeapon - weapon to check for
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CTriggerWeaponDissolve::HasWeapon( CBaseCombatWeapon *pWeapon )
{
if ( m_pWeapons.Find( pWeapon ) == m_pWeapons.InvalidIndex() )
return false;
return true;
}
示例6: ActivateSpeaker
//-----------------------------------------------------------------------------
// Purpose: If we've got a speaker, add ourselves to the list of microphones that want to listen
//-----------------------------------------------------------------------------
void CEnvMicrophone::ActivateSpeaker( void )
{
// If we're enabled, set the dsp_speaker preset to my specified one
if ( !m_bDisabled )
{
ConVarRef dsp_speaker( "dsp_speaker" );
if ( dsp_speaker.IsValid() )
{
int iDSPPreset = m_iSpeakerDSPPreset;
if ( !iDSPPreset )
{
// Reset it to the default
iDSPPreset = atoi( dsp_speaker.GetDefault() );
}
DevMsg( 2, "Microphone %s set dsp_speaker to %d.\n", STRING(GetEntityName()), iDSPPreset);
dsp_speaker.SetValue( m_iSpeakerDSPPreset );
}
}
if ( m_iszSpeakerName != NULL_STRING )
{
// We've got a speaker to play heard sounds through. To do this, we need to add ourselves
// to the list of microphones who want to be told whenever a sound is played.
if ( s_Microphones.Find(this) == -1 )
{
s_Microphones.AddToTail( this );
}
}
}
示例7: PrecacheSceneEvent
//-----------------------------------------------------------------------------
// Purpose: Static method
// Input : *event -
// soundlist -
//-----------------------------------------------------------------------------
void CSceneCache::PrecacheSceneEvent( CChoreoEvent *event, CUtlVector< unsigned short >& soundlist )
{
if ( !event || event->GetType() != CChoreoEvent::SPEAK )
return;
int idx = soundemitterbase->GetSoundIndex( event->GetParameters() );
if ( idx != -1 )
{
MEM_ALLOC_CREDIT();
Assert( idx <= 65535 );
soundlist.AddToTail( (unsigned short)idx );
}
if ( event->GetCloseCaptionType() == CChoreoEvent::CC_MASTER )
{
char tok[ CChoreoEvent::MAX_CCTOKEN_STRING ];
if ( event->GetPlaybackCloseCaptionToken( tok, sizeof( tok ) ) )
{
int idx = soundemitterbase->GetSoundIndex( tok );
if ( idx != -1 && soundlist.Find( idx ) == soundlist.InvalidIndex() )
{
MEM_ALLOC_CREDIT();
Assert( idx <= 65535 );
soundlist.AddToTail( (unsigned short)idx );
}
}
}
}
示例8: Spawn
void Spawn( void )
{
// add this element if it isn't already in the list
if ( g_CaptureZones.Find( entindex() ) == -1 )
{
g_CaptureZones.AddToTail( entindex() );
}
}
示例9: RemoveFromList
void CBullseyeList::RemoveFromList( CNPC_Bullseye *pBullseye )
{
int index = m_list.Find( pBullseye );
if ( index != m_list.InvalidIndex() )
{
m_list.FastRemove( index );
}
}
示例10:
void CSecobModportal1List::RemoveFromList( CNPC_SecobModportal1 *pSecobModportal1 )
{
int index = m_list.Find( pSecobModportal1 );
if ( index != m_list.InvalidIndex() )
{
m_list.FastRemove( index );
}
}
示例11: FindAndRemoveExecutionMarker
static bool FindAndRemoveExecutionMarker( int iCode )
{
int i = g_ExecutionMarkers.Find( iCode );
if ( i == g_ExecutionMarkers.InvalidIndex() )
return false;
g_ExecutionMarkers.Remove( i );
return true;
}
示例12: Spawn
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TeamTrainWatcher::Spawn( void )
{
BaseClass::Spawn();
if ( g_hTrainWatchers.Find( this ) == g_hTrainWatchers.InvalidIndex() )
{
g_hTrainWatchers.AddToTail( this );
}
}
示例13: CC_asw_teleport_autocomplete
static int CC_asw_teleport_autocomplete( char const *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] )
{
if ( !g_pGameRules )
{
return 0;
}
char const *cmdname = "asw_teleport";
char *substring = (char *)partial;
if ( Q_strstr( partial, cmdname ) )
{
substring = (char *)partial + strlen( cmdname ) + 1;
}
int checklen = Q_strlen( substring );
CUtlSymbolTable entries( 0, 0, true );
CUtlVector< CUtlSymbol > symbols;
CBaseEntity *pos = NULL;
while ( ( pos = gEntList.NextEnt( pos ) ) != NULL )
{
// Check target name against partial string
if ( pos->GetEntityName() == NULL_STRING )
continue;
if ( Q_strnicmp( STRING( pos->GetEntityName() ), substring, checklen ) )
continue;
CUtlSymbol sym = entries.AddString( STRING( pos->GetEntityName() ) );
int idx = symbols.Find( sym );
if ( idx == symbols.InvalidIndex() )
{
symbols.AddToTail( sym );
}
// Too many
if ( symbols.Count() >= COMMAND_COMPLETION_MAXITEMS )
break;
}
// Now fill in the results
for ( int i = 0; i < symbols.Count(); i++ )
{
char const *name = entries.String( symbols[ i ] );
char buf[ 512 ];
Q_strncpy( buf, name, sizeof( buf ) );
Q_strlower( buf );
Q_snprintf( commands[ i ], COMMAND_COMPLETION_ITEM_LENGTH, "%s %s",
cmdname, buf );
}
return symbols.Count();
}
示例14: AddColorCorrectionVolume
ClientCCHandle_t CColorCorrectionMgr::AddColorCorrectionVolume( C_ColorCorrectionVolume *pVolume, const char *pName, const char *pFileName )
{
ClientCCHandle_t h = AddColorCorrection(pName, pFileName);
if ( h != INVALID_CLIENT_CCHANDLE )
{
Assert(g_ColorCorrectionVolumeList.Find(pVolume) == -1);
g_ColorCorrectionVolumeList.AddToTail(pVolume);
}
return h;
}
示例15: DataTable_MaybeCreateReceiveTable
// If the table's ID is -1, writes its info into the buffer and increments curID.
void DataTable_MaybeCreateReceiveTable( CUtlVector< SendTable * >& visited, SendTable *pTable, bool bNeedDecoder )
{
// Already sent?
if ( visited.Find( pTable ) != visited.InvalidIndex() )
return;
visited.AddToTail( pTable );
DataTable_SetupReceiveTableFromSendTable( pTable, bNeedDecoder );
}