本文整理汇总了C++中CUtlVector::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ CUtlVector::Count方法的具体用法?C++ CUtlVector::Count怎么用?C++ CUtlVector::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtlVector
的用法示例。
在下文中一共展示了CUtlVector::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CleanupDeleteList
// call this before and after each frame to delete all of the marked entities.
void CGlobalEntityList::CleanupDeleteList( void )
{
VPROF( "CGlobalEntityList::CleanupDeleteList" );
g_fInCleanupDelete = true;
// clean up the vphysics delete list as well
PhysOnCleanupDeleteList();
g_bDisableEhandleAccess = true;
for ( int i = 0; i < g_DeleteList.Count(); i++ )
{
g_DeleteList[i]->Release();
}
g_bDisableEhandleAccess = false;
g_DeleteList.RemoveAll();
g_fInCleanupDelete = false;
}
示例2: CopyListPanelToClipboard
void CopyListPanelToClipboard( vgui::ListPanel *pListPanel )
{
CUtlVector<char> textBuf;
// Write the headers.
int nColumns = pListPanel->GetNumColumnHeaders();
for ( int i=0; i < nColumns; i++ )
{
if ( i != 0 )
textBuf.AddToTail( '\t' );
char tempText[512];
if ( !pListPanel->GetColumnHeaderText( i, tempText, sizeof( tempText ) ) )
Error( "GetColumHeaderText( %d ) failed", i );
textBuf.AddMultipleToTail( strlen( tempText ), tempText );
}
textBuf.AddToTail( '\n' );
// Now write the rows.
int iCur = pListPanel->FirstItem();
while ( iCur != pListPanel->InvalidItemID() )
{
// Write the columns for this row.
for ( int i=0; i < nColumns; i++ )
{
if ( i != 0 )
textBuf.AddToTail( '\t' );
wchar_t tempTextWC[512];
char tempText[512];
pListPanel->GetCellText( iCur, i, tempTextWC, sizeof( tempTextWC ) );
g_pVGuiLocalize->ConvertUnicodeToANSI( tempTextWC, tempText, sizeof( tempText ) );
textBuf.AddMultipleToTail( strlen( tempText ), tempText );
}
textBuf.AddToTail( '\n' );
iCur = pListPanel->NextItem( iCur );
}
textBuf.AddToTail( 0 );
// Set the clipboard text.
vgui::system()->SetClipboardText( textBuf.Base(), textBuf.Count() );
}
示例3: FindMissionsInCampaign
void CASW_Mission_Chooser_Source_Local::FindMissionsInCampaign( int iCampaignIndex, int nMissionOffset, int iNumSlots )
{
if (!m_bBuiltMapList)
BuildMapList();
ASW_Mission_Chooser_Mission* pCampaign = GetCampaign( iCampaignIndex );
if ( !pCampaign )
return;
KeyValues *pCampaignDetails = GetCampaignDetails( pCampaign->m_szMissionName );
if ( !pCampaignDetails )
return;
CUtlVector<KeyValues*> aMissionKeys;
bool bSkippedFirst = false;
for ( KeyValues *pMission = pCampaignDetails->GetFirstSubKey(); pMission; pMission = pMission->GetNextKey() )
{
if ( !Q_stricmp( pMission->GetName(), "MISSION" ) )
{
if ( !bSkippedFirst )
{
bSkippedFirst = true;
}
else
{
aMissionKeys.AddToTail( pMission );
}
}
}
int max_items = aMissionKeys.Count();
for ( int stored=0;stored<iNumSlots;stored++ )
{
int realoffset = nMissionOffset;
if ( realoffset >= max_items || realoffset < 0 )
{
// no more missions...
Q_snprintf( m_missions[stored].m_szMissionName, sizeof( m_missions[stored].m_szMissionName ), "" );
}
else
{
Q_snprintf( m_missions[stored].m_szMissionName, sizeof( m_missions[stored].m_szMissionName ), "%s", aMissionKeys[realoffset]->GetString( "MapName" ) );
}
nMissionOffset++;
}
}
示例4: TestAllResponses
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CAI_Expresser::TestAllResponses()
{
IResponseSystem *pResponseSystem = GetOuter()->GetResponseSystem();
if ( pResponseSystem )
{
CUtlVector<AI_Response *> responses;
pResponseSystem->GetAllResponses( &responses );
for ( int i = 0; i < responses.Count(); i++ )
{
char response[ 256 ];
responses[i]->GetResponse( response, sizeof( response ) );
Msg( "Response: %s\n", response );
SpeakDispatchResponse( "", responses[i] );
}
}
}
示例5: ComputeLightingOrigin
//-----------------------------------------------------------------------------
// Computes the lighting origin
//-----------------------------------------------------------------------------
static bool ComputeLightingOrigin( StaticPropBuild_t const& build, Vector& lightingOrigin )
{
for (int i = s_LightingInfo.Count(); --i >= 0; )
{
int entIndex = s_LightingInfo[i];
// Check against all lighting info entities
char const* pTargetName = ValueForKey( &entities[entIndex], "targetname" );
if (!Q_strcmp(pTargetName, build.m_pLightingOrigin))
{
GetVectorForKey( &entities[entIndex], "origin", lightingOrigin );
return true;
}
}
return false;
}
示例6: ShowHandMagic
void C_CFPlayer::ShowHandMagic(C_BaseEntity* pEnt, CUtlVector<CNewParticleEffect*>& aHandComboEffects, element_t eElements, const char* pszAttachment)
{
MDLCACHE_CRITICAL_SECTION();
int i;
for (i = 0; i < aHandComboEffects.Count(); i++)
pEnt->ParticleProp()->StopEmission(aHandComboEffects[i]);
aHandComboEffects.RemoveAll();
for (i = 0; i < TOTAL_ELEMENTS; i++)
{
if (!(eElements&(1<<i)))
continue;
aHandComboEffects.AddToTail(pEnt->ParticleProp()->Create( VarArgs("hand_%s", ElementToString((element_t)(1<<i))), PATTACH_POINT_FOLLOW, pszAttachment ));
}
}
示例7: assert
int CUtlVector<T, A>::AddVectorToTail(CUtlVector const &src)
{
assert(&src != this);
int base = Count();
// Make space.
int nSrcCount = src.Count();
EnsureCapacity(base + nSrcCount);
// Copy the elements.
m_Size += nSrcCount;
for(int i = 0; i < nSrcCount; i++) {
CopyConstruct(&Element(base + i), src[i]);
}
return base;
}
示例8: ParseParticleEffects
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void ParseParticleEffects( bool bLoadSheets )
{
MEM_ALLOC_CREDIT();
g_pParticleSystemMgr->ShouldLoadSheets( bLoadSheets );
CUtlVector<CUtlString> files;
GetParticleManifest( files );
int nCount = files.Count();
for ( int i = 0; i < nCount; ++i )
{
g_pParticleSystemMgr->ReadParticleConfigFile( files[i], false, false );
}
g_pParticleSystemMgr->DecommitTempMemory();
}
示例9: OnDragFailed
virtual void OnDragFailed( CUtlVector< KeyValues * >& msglist )
{
PropertySheet *sheet = IsDroppingSheet( msglist );
if ( !sheet )
return;
// Create a new property sheet
if ( m_pParent->IsDraggableTab() )
{
if ( msglist.Count() == 1 )
{
KeyValues *data = msglist[ 0 ];
int screenx = data->GetInt( "screenx" );
int screeny = data->GetInt( "screeny" );
// m_pParent->ScreenToLocal( screenx, screeny );
if ( !m_pParent->IsWithin( screenx, screeny ) )
{
Panel *page = reinterpret_cast< Panel * >( data->GetPtr( "propertypage" ) );
PropertySheet *sheet = reinterpret_cast< PropertySheet * >( data->GetPtr( "propertysheet" ) );
char const *title = data->GetString( "tabname", "" );
if ( !page || !sheet )
return;
// Can only create if sheet was part of a ToolWindow derived object
ToolWindow *tw = dynamic_cast< ToolWindow * >( sheet->GetParent() );
if ( tw )
{
IToolWindowFactory *factory = tw->GetToolWindowFactory();
if ( factory )
{
bool hasContextMenu = sheet->PageHasContextMenu( page );
sheet->RemovePage( page );
factory->InstanceToolWindow( tw->GetParent(), sheet->ShouldShowContextButtons(), page, title, hasContextMenu );
if ( sheet->GetNumPages() == 0 )
{
tw->MarkForDeletion();
}
}
}
}
}
}
}
示例10: Update
void CSlideshowDisplayScreen::Update( C_SlideshowDisplay *pSlideshowDisplay )
{
char szBuff[ 256 ];
pSlideshowDisplay->GetDisplayText( szBuff );
m_pDisplayTextLabel->SetText( szBuff );
if ( m_pSlideshowImages.Count() == 0 )
{
// Build the list of image panels!
for ( int iSlide = 0; iSlide < pSlideshowDisplay->NumMaterials(); ++iSlide )
{
m_pSlideshowImages.AddToTail( SETUP_PANEL( new ImagePanel( this, "SlideshowImage" ) ) );
int iMatIndex = pSlideshowDisplay->GetMaterialIndex( iSlide );
if ( iMatIndex > 0 )
{
const char *pMaterialName = GetMaterialNameFromIndex( iMatIndex );
if ( pMaterialName )
{
pMaterialName = Q_strnchr( pMaterialName, '/', Q_strlen( pMaterialName ) );
if ( pMaterialName )
{
pMaterialName = pMaterialName + 1;
m_pSlideshowImages[ iSlide ]->SetImage( pMaterialName );
m_pSlideshowImages[ iSlide ]->SetVisible( false );
m_pSlideshowImages[ iSlide ]->SetZPos( -3 );
m_pSlideshowImages[ iSlide ]->SetWide( GetWide() );
m_pSlideshowImages[ iSlide ]->SetTall( GetTall() );
}
}
}
}
}
int iCurrentSlideIndex = pSlideshowDisplay->CurrentSlideIndex();
if ( iCurrentSlideIndex != iLastSlideIndex )
{
m_pSlideshowImages[ iLastSlideIndex ]->SetVisible( false );
m_pSlideshowImages[ iCurrentSlideIndex ]->SetVisible( true );
iLastSlideIndex = iCurrentSlideIndex;
}
}
示例11: InvokeMethodTickProgress
//-----------------------------------------------------------------------------
// Invokes a method on all installed game systems in proper order
//-----------------------------------------------------------------------------
void InvokeMethodTickProgress( GameSystemFunc_t f, char const *timed /*=0*/ )
{
NOTE_UNUSED( timed );
int i;
int c = s_GameSystems.Count();
for ( i = 0; i < c ; ++i )
{
IGameSystem *sys = s_GameSystems[i];
MDLCACHE_COARSE_LOCK();
MDLCACHE_CRITICAL_SECTION();
#if defined( CLIENT_DLL )
engine->TickProgressBar();
#endif
(sys->*f)();
}
}
示例12: CanQuit
//-----------------------------------------------------------------------------
// Purpose: Returns true if all handlers say we can quit the engine
//-----------------------------------------------------------------------------
bool CEngineTool::CanQuit()
{
int c = m_QuitHandlers.Count();
for ( int i = 0; i < c; ++i )
{
QuitHandler_t& qh = m_QuitHandlers[ i ];
FnQuitHandler func = qh.func;
if ( func )
{
if ( !func( qh.userdata ) )
{
return false;
}
}
}
return true;
}
示例13: SendTable_ComputeCRC
//-----------------------------------------------------------------------------
// Purpose: Computes the crc for all sendtables for the data sent in the class/table definitions
// Output : CRC32_t
//-----------------------------------------------------------------------------
CRC32_t SendTable_ComputeCRC()
{
CRC32_t result;
CRC32_Init( &result );
// walk the tables and checksum them
int c = g_SendTables.Count();
for ( int i = 0 ; i < c; i++ )
{
SendTable *st = g_SendTables[ i ];
result = SendTable_CRCTable( result, st );
}
CRC32_Final( &result );
return result;
}
示例14:
disp_grid_t &FindOrInsertGrid( int gridIndex )
{
// linear search is slow, but only a few grids will be present
for ( int i = gDispGridList.Count()-1; i >= 0; i-- )
{
if ( gDispGridList[i].gridIndex == gridIndex )
{
return gDispGridList[i];
}
}
int index = gDispGridList.AddToTail();
gDispGridList[index].gridIndex = gridIndex;
// must be empty
Assert( gDispGridList[index].dispList.Count() == 0 );
return gDispGridList[index];
}
示例15: QueueStartEvent
void C_SceneEntity::QueueStartEvent( float starttime, CChoreoScene *scene, CChoreoEvent *event )
{
// Check for duplicates
int c = m_QueuedEvents.Count();
for ( int i = 0; i < c; ++i )
{
const QueuedEvents_t& check = m_QueuedEvents[ i ];
if ( check.scene == scene &&
check.event == event )
return;
}
QueuedEvents_t qe;
qe.scene = scene;
qe.event = event;
qe.starttime = starttime;
m_QueuedEvents.AddToTail( qe );
}