本文整理汇总了C++中CUtlDict::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ CUtlDict::Count方法的具体用法?C++ CUtlDict::Count怎么用?C++ CUtlDict::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtlDict
的用法示例。
在下文中一共展示了CUtlDict::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
char const *CMapEntities::GetName( int number )
{
if ( number < 0 || number >= (int)m_Entities.Count() )
return NULL;
return m_Entities.GetElementName( number );
}
示例2: PrecacheFileWeaponInfoDatabase
void PrecacheFileWeaponInfoDatabase( IFileSystem *filesystem, const unsigned char *pICEKey )
{
if ( m_WeaponInfoDatabase.Count() )
return;
KeyValues *manifest = new KeyValues( "weaponscripts" );
if ( manifest->LoadFromFile( filesystem, "scripts/weapon_manifest.txt", "GAME" ) )
{
for ( KeyValues *sub = manifest->GetFirstSubKey(); sub != NULL ; sub = sub->GetNextKey() )
{
if ( !Q_stricmp( sub->GetName(), "file" ) )
{
char fileBase[512];
Q_FileBase( sub->GetString(), fileBase, sizeof(fileBase) );
WEAPON_FILE_INFO_HANDLE tmp;
#ifdef CLIENT_DLL
if ( ReadWeaponDataFromFileForSlot( filesystem, fileBase, &tmp, pICEKey ) )
{
gWR.LoadWeaponSprites( tmp );
}
#else
ReadWeaponDataFromFileForSlot( filesystem, fileBase, &tmp, pICEKey );
#endif
}
else
{
Error( "Expecting 'file', got %s\n", sub->GetName() );
}
}
}
manifest->deleteThis();
}
示例3: Save
virtual void Save( const SaveRestoreFieldInfo_t &fieldInfo, ISave *pSave )
{
CUtlDict< ConceptHistory_t, int > *ch = ((CUtlDict< ConceptHistory_t, int > *)fieldInfo.pField);
int count = ch->Count();
pSave->WriteInt( &count );
for ( int i = 0 ; i < count; i++ )
{
ConceptHistory_t *pHistory = &(*ch)[ i ];
pSave->StartBlock();
{
// Write element name
pSave->WriteString( ch->GetElementName( i ) );
// Write data
pSave->WriteAll( pHistory );
// Write response blob
bool hasresponse = pHistory->response != NULL ? true : false;
pSave->WriteBool( &hasresponse );
if ( hasresponse )
{
pSave->WriteAll( pHistory->response );
}
// TODO: Could blat out pHistory->criteria pointer here, if it's needed
}
pSave->EndBlock();
}
}
示例4: PrecacheFileWeaponInfoDatabase
void PrecacheFileWeaponInfoDatabase( IFileSystem *filesystem, const unsigned char *pICEKey )
{
if ( m_WeaponInfoDatabase.Count() )
return;
#if !defined( _XBOX )
FileFindHandle_t findHandle;
const char *pFilename = filesystem->FindFirstEx( "scripts/weapon_*.txt", IsXbox() ? "XGAME" : "GAME", &findHandle );
while ( pFilename != NULL )
{
char fileBase[512];
Q_FileBase( pFilename, fileBase, sizeof(fileBase) );
WEAPON_FILE_INFO_HANDLE tmp;
#ifdef CLIENT_DLL
if ( ReadWeaponDataFromFileForSlot( filesystem, fileBase, &tmp, pICEKey ) )
{
gWR.LoadWeaponSprites( tmp );
}
#else
ReadWeaponDataFromFileForSlot( filesystem, fileBase, &tmp, pICEKey );
#endif
pFilename = filesystem->FindNext( findHandle );
}
filesystem->FindClose( findHandle );
#else
#define WEAPON_SCRIPT_MANIFEST_FILE "scripts/_weapon_manifest.txt"
// Use a manifest file on the xbox
KeyValues *manifest = new KeyValues( "weaponscripts" );
if ( manifest->LoadFromFile( filesystem, WEAPON_SCRIPT_MANIFEST_FILE, "XGAME" ) )
{
for ( KeyValues *sub = manifest->GetFirstSubKey(); sub != NULL ; sub = sub->GetNextKey() )
{
if ( !Q_stricmp( sub->GetName(), "file" ) )
{
char fileBase[512];
Q_FileBase( sub->GetString(), fileBase, sizeof(fileBase) );
WEAPON_FILE_INFO_HANDLE tmp;
#ifdef CLIENT_DLL
if ( ReadWeaponDataFromFileForSlot( filesystem, fileBase, &tmp, pICEKey ) )
{
gWR.LoadWeaponSprites( tmp );
}
#else
ReadWeaponDataFromFileForSlot( filesystem, fileBase, &tmp, pICEKey );
#endif
}
else
{
Error( "Expecting 'file', got %s\n", sub->GetName() );
}
}
}
manifest->deleteThis();
#endif
}
示例5: FreeHudTextureList
//-----------------------------------------------------------------------------
// Purpose:
// Input : * -
// list -
//-----------------------------------------------------------------------------
void FreeHudTextureList(CUtlDict< CHudTexture *, int >& list)
{
int c = list.Count();
for (int i = 0; i < c; i++)
{
CHudTexture *tex = list[i];
delete tex;
}
list.RemoveAll();
}
示例6:
//-----------------------------------------------------------------------------
// Purpose:
// Sets the name of the bitmap from decals.wad to be used in a specific slot #
// called from cl_parse.cpp twice
// This sets the name of a decal prototype texture
// Input : decal -
// *name -
//-----------------------------------------------------------------------------
// called from gl_rsurf.cpp
IMaterial *Draw_DecalMaterial( int index )
{
if ( index < 0 || index >= g_DecalLookup.Count() )
return NULL;
int slot = g_DecalLookup[ index ];
if ( slot < 0 || slot >= (int)g_DecalDictionary.Count() )
return NULL;
return g_DecalDictionary[ slot ].material;
}
示例7: ResetFileWeaponInfoDatabase
void ResetFileWeaponInfoDatabase( void )
{
int c = m_WeaponInfoDatabase.Count();
for ( int i = 0; i < c; ++i )
{
delete m_WeaponInfoDatabase[ i ];
}
m_WeaponInfoDatabase.RemoveAll();
#ifdef _DEBUG
memset(g_bUsedWeaponSlots, 0, sizeof(g_bUsedWeaponSlots));
#endif
}
示例8: CorrelateWavsAndVCDs
void CorrelateWavsAndVCDs( CUtlVector< CUtlSymbol >& vcdfiles, CUtlVector< CUtlSymbol >& wavfiles )
{
CUtlDict< VCDList, int > database;
int i;
int c = vcdfiles.Count();
for ( i = 0; i < c; i++ )
{
CUtlSymbol& vcdname = vcdfiles[ i ];
// Load the .vcd and update the database
ProcessVCD( database, vcdname );
}
if ( vcdonly )
return;
vprint( 0, "Found %i wav files in %i vcds\n",
database.Count(), vcdfiles.Count() );
// Now look for any wavfiles that weren't in the database
int ecount = 0;
c = wavfiles.Count();
for ( i = 0; i < c; i++ )
{
CUtlSymbol& wavename = wavfiles[ i ];
int idx = database.Find( g_Analysis.symbols.String( wavename ) );
if ( idx != database.InvalidIndex() )
{
VCDList *listentry = &database[ idx ];
int vcdcount = listentry->vcds.Count();
if ( vcdcount >= 2 && verbose )
{
vprint( 0, " wave '%s' used by multiple .vcds:\n", g_Analysis.symbols.String( wavename ) );
int j;
for ( j = 0; j < vcdcount; j++ )
{
vprint( 1, "%i -- '%s'\n", j+1, g_Analysis.symbols.String( listentry->vcds[ j ] ) );
}
}
continue;
}
vprint( 0, "%i -- '%s' not referenced by .vcd\n",
++ecount, g_Analysis.symbols.String( wavename ) );
}
vprint( 0, "\nSummary: found %i/%i (%.2f percent) .wav errors\n", ecount, c, 100.0 * ecount / max( c, 1 ) );
}
示例9:
//-----------------------------------------------------------------------------
// Purpose:
// Input : handle -
// Output : FileItemInfo_t
//-----------------------------------------------------------------------------
FileItemInfo_t *GetFileItemInfoFromHandle( ITEM_FILE_INFO_HANDLE handle )
{
if ( handle < 0 || handle >= m_ItemInfoDatabase.Count() )
{
return &gNullItemInfo;
}
if ( handle == m_ItemInfoDatabase.InvalidIndex() )
{
return &gNullItemInfo;
}
return m_ItemInfoDatabase[ handle ];
}
示例10:
//-----------------------------------------------------------------------------
// Purpose:
// Input : handle -
// Output : FilePlayerClassInfo_t
//-----------------------------------------------------------------------------
FilePlayerClassInfo_t *GetFilePlayerClassInfoFromHandle( PLAYERCLASS_FILE_INFO_HANDLE handle )
{
if ( handle < 0 || handle >= m_PlayerClassInfoDatabase.Count() )
{
return &gNullPlayerClassInfo;
}
if ( handle == m_PlayerClassInfoDatabase.InvalidIndex() )
{
return &gNullPlayerClassInfo;
}
return m_PlayerClassInfoDatabase[ handle ];
}
示例11: FindNext
int CTextureManager::FindNext( int iIndex, ITextureInternal **pTexInternal )
{
if ( iIndex == -1 && m_TextureList.Count() )
{
iIndex = m_TextureList.First();
}
else if ( !m_TextureList.Count() || !m_TextureList.IsValidIndex( iIndex ) )
{
*pTexInternal = NULL;
return -1;
}
*pTexInternal = m_TextureList[iIndex];
iIndex = m_TextureList.Next( iIndex );
if ( iIndex == m_TextureList.InvalidIndex() )
{
// end of list
iIndex = -1;
}
return iIndex;
}
示例12:
//-----------------------------------------------------------------------------
// Purpose:
// Input : handle -
// Output : FileWeaponInfo_t
//-----------------------------------------------------------------------------
FileWeaponInfo_t *GetFileWeaponInfoFromHandle( WEAPON_FILE_INFO_HANDLE handle )
{
if ( handle < 0 || handle >= m_WeaponInfoDatabase.Count() )
{
return &gNullWeaponInfo;
}
if ( handle == m_WeaponInfoDatabase.InvalidIndex() )
{
return &gNullWeaponInfo;
}
return m_WeaponInfoDatabase[ handle ];
}
示例13: RemoveAllScripted
void CClassMap::RemoveAllScripted( void )
{
int c = m_ClassDict.Count();
int i;
for ( i = 0; i < c; i++ )
{
classentry_t *lookup = &m_ClassDict[ i ];
if ( !lookup )
continue;
if ( lookup->scripted )
{
m_ClassDict.RemoveAt( i );
}
}
}
示例14: Decal_Shutdown
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void Decal_Shutdown( void )
{
g_DecalLookup.Purge();
int c = g_DecalDictionary.Count();
int decal;
for ( decal = 0; decal < c; decal++ )
{
IMaterial *mat = g_DecalDictionary[ decal ].material;
if ( mat )
{
GL_UnloadMaterial( mat );
}
}
g_DecalDictionary.Purge();
}
示例15: GetClassSize
int CClassMap::GetClassSize( const char *classname )
{
int c = m_ClassDict.Count();
int i;
for ( i = 0; i < c; i++ )
{
classentry_t *lookup = &m_ClassDict[ i ];
if ( !lookup )
continue;
if ( Q_strcmp( lookup->GetMapName(), classname ) )
continue;
return lookup->size;
}
return -1;
}