本文整理汇总了C++中CUtlVector::Purge方法的典型用法代码示例。如果您正苦于以下问题:C++ CUtlVector::Purge方法的具体用法?C++ CUtlVector::Purge怎么用?C++ CUtlVector::Purge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtlVector
的用法示例。
在下文中一共展示了CUtlVector::Purge方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndTouch
//-----------------------------------------------------------------------------
// Purpose: Called when an entity stops touching us.
// Input : pOther - The entity that was touching us.
//-----------------------------------------------------------------------------
void CTriggerWateryDeath::EndTouch( CBaseEntity *pOther )
{
if ( IsTouching( pOther ) )
{
EHANDLE hOther;
hOther = pOther;
// Remove the time from our list
int iIndex = m_hTouchingEntities.Find( hOther );
if ( iIndex != m_hTouchingEntities.InvalidIndex() )
{
m_flEntityKillTimes.Remove( iIndex );
}
}
#ifdef HL2_DLL
if ( pOther->IsPlayer() )
{
for (int i = 0; i < m_hLeeches.Count(); i++ )
{
CWateryDeathLeech *pLeech = dynamic_cast<CWateryDeathLeech*>( m_hLeeches[i].Get() );
if ( pLeech )
{
pLeech->m_iFadeState = -1;
}
}
if ( m_hLeeches.Count() > 0 )
m_hLeeches.Purge();
CHL2_Player *pHL2Player = dynamic_cast<CHL2_Player*>( pOther );
if ( pHL2Player )
{
//Adrian: Hi, you might be wondering why I'm doing this, yes?
// Well, EndTouch is called not only when the player leaves
// the trigger, but also on level shutdown. We can't let the
// soundpatch fade the sound out since we'll hit a nasty assert
// cause it'll try to fade out a sound using an entity that might
// be gone since we're shutting down the server.
if ( !(pHL2Player->GetFlags() & FL_DONTTOUCH ) )
pHL2Player->StopWaterDeathSounds();
}
}
#endif
BaseClass::EndTouch( pOther );
}
示例2: Spawn
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CNPC_CraneDriver::Spawn( void )
{
BaseClass::Spawn();
CapabilitiesClear();
CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 );
m_flDistTooFar = 2048.0;
SetDistLook( 2048 );
m_PreviouslyPickedUpObjects.Purge();
m_hPickupTarget = NULL;
m_bForcedPickup = false;
m_bForcedDropoff = false;
}
示例3: SystemReset
// Reset the whole system (level change, etc.)
void CSoundControllerImp::SystemReset( void )
{
for ( int i = m_soundList.Count()-1; i >=0; i-- )
{
CSoundPatch *pNode = m_soundList[i];
// shutdown all active sounds
pNode->Shutdown();
}
// clear the list
m_soundList.Purge();
// clear the command queue
m_commandList.RemoveAll();
}
示例4: Decal_Shutdown
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void Decal_Shutdown( void )
{
for ( int index = g_DecalDictionary.FirstInorder(); index != g_DecalDictionary.InvalidIndex(); index = g_DecalDictionary.NextInorder(index) )
{
IMaterial *mat = g_DecalDictionary[index].material;
if ( mat )
{
GL_UnloadMaterial( mat );
}
#ifdef _DEBUG
delete[] g_DecalDictionary[index].m_pDebugName;
#endif
}
g_DecalLookup.Purge();
g_DecalDictionary.RemoveAll();
}
示例5: FindFiles
//-----------------------------------------------------------------------------
// Purpose: Generate a list of file matching mask
//-----------------------------------------------------------------------------
int CScriptLib::FindFiles( char* pFileMask, bool bRecurse, CUtlVector<fileList_t> &fileList )
{
char dirPath[MAX_PATH];
char pattern[MAX_PATH];
char extension[MAX_PATH];
// get path only
strcpy( dirPath, pFileMask );
V_StripFilename( dirPath );
// get pattern only
V_FileBase( pFileMask, pattern, sizeof( pattern ) );
V_ExtractFileExtension( pFileMask, extension, sizeof( extension ) );
if ( extension[0] )
{
strcat( pattern, "." );
strcat( pattern, extension );
}
if ( !bRecurse )
{
GetFileList( dirPath, pattern, fileList );
}
else
{
// recurse and get the tree
CUtlVector< fileList_t > tempList;
CUtlVector< CUtlString > dirList;
RecurseFileTree_r( dirPath, 0, dirList );
for ( int i=0; i<dirList.Count(); i++ )
{
// iterate each directory found
tempList.Purge();
tempList.EnsureCapacity( dirList.Count() );
GetFileList( dirList[i].String(), pattern, tempList );
int start = fileList.AddMultipleToTail( tempList.Count() );
for ( int j=0; j<tempList.Count(); j++ )
{
fileList[start+j] = tempList[j];
}
}
}
return fileList.Count();
}
示例6: OnThink
//================================================================================
//================================================================================
void CefBasePanel::OnThink()
{
VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_CEF );
// Hay comandos que deben ejecutarse
if ( g_QueueCommands.Count() > 0 )
{
for ( int it = 0; it < g_QueueCommands.Count(); ++it )
{
const char *pCommand = g_QueueCommands[it];
engine->ExecuteClientCmd( pCommand );
DevMsg( "[OnThink] engine.command: %s\n", pCommand );
}
g_QueueCommands.Purge();
}
}
示例7: 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();
}
示例8: Serialize
bool CVRadDLL::Serialize()
{
if( !g_pIncremental )
return false;
if( g_LastGoodLightData.Count() > 0 )
{
pdlightdata->CopyArray( g_LastGoodLightData.Base(), g_LastGoodLightData.Count() );
if( g_pIncremental->Serialize() )
{
// Delete this so it doesn't keep re-saving it.
g_LastGoodLightData.Purge();
return true;
}
}
return false;
}
示例9: EatTextModeKeyPresses
void EatTextModeKeyPresses()
{
if ( !g_bTextMode )
return;
static bool bFirstRun = true;
if ( bFirstRun )
{
bFirstRun = false;
MoveConsoleWindowToFront();
}
char ch;
while ( (ch = NextGetch()) != -1 )
{
if ( ch == 8 )
{
// Backspace..
if ( g_TextModeLine.Count() )
{
g_TextModeLine.Remove( g_TextModeLine.Count() - 1 );
}
}
else if ( ch == '\r' )
{
// Finish the line.
if ( g_TextModeLine.Count() )
{
g_TextModeLine.AddMultipleToTail( 2, "\n" );
Cbuf_AddText( g_TextModeLine.Base() );
g_TextModeLine.Purge();
}
printf( "\n" );
}
else
{
g_TextModeLine.AddToTail( ch );
}
printf( "%c", ch );
}
}
示例10: ExcludePathsDlg_SaveChanges
//-----------------------------------------------------------------------------
// ExcludePathsDlg_SaveChanges
//
//-----------------------------------------------------------------------------
void ExcludePathsDlg_SaveChanges( HWND hWnd )
{
g_ExcludePaths.Purge();
HWND hWndTree = GetDlgItem( hWnd, IDC_PATHS_TREE );
ExcludePathsDlg_BuildExcludeList_r( hWndTree, TreeView_GetRoot( hWndTree ), 0, "" );
char szPath[MAX_PATH];
V_ComposeFileName( g_localPath, EXCLUDEPATHS_FILE, szPath, sizeof( szPath ) );
if ( !g_ExcludePaths.Count() )
{
// no exclude paths
unlink( szPath );
}
else
{
FILE *fp = fopen( szPath, "wt" );
if ( !fp )
{
Sys_MessageBox( "Error", "Could not open '%s' for writing\n", szPath );
return;
}
fprintf( fp, "// Auto-Generated by VXConsole - DO NOT MODIFY!\n" );
for ( int i = 0; i < g_ExcludePaths.Count(); i++ )
{
// strip expected root path
const char *pPath = g_ExcludePaths[i].String();
pPath += strlen( ROOT_NAME );
if ( !pPath[0] )
{
// special code for root
fprintf( fp, "*\n" );
break;
}
fprintf( fp, "\"\\%s\"\n", pPath );
}
fclose( fp );
}
}
示例11: V_SplitString2
void V_SplitString2( const char *pString, const char **pSeparators, int nSeparators, CUtlVector<char*> &outStrings )
{
outStrings.Purge();
const char *pCurPos = pString;
while ( 1 )
{
int iFirstSeparator = -1;
const char *pFirstSeparator = 0;
for ( int i=0; i < nSeparators; i++ )
{
const char *pTest = V_stristr( pCurPos, pSeparators[i] );
if ( pTest && (!pFirstSeparator || pTest < pFirstSeparator) )
{
iFirstSeparator = i;
pFirstSeparator = pTest;
}
}
if ( pFirstSeparator )
{
// Split on this separator and continue on.
int separatorLen = strlen( pSeparators[iFirstSeparator] );
if ( pFirstSeparator > pCurPos )
{
outStrings.AddToTail( AllocString( pCurPos, pFirstSeparator-pCurPos ) );
}
pCurPos = pFirstSeparator + separatorLen;
}
else
{
// Copy the rest of the string
if ( strlen( pCurPos ) )
{
outStrings.AddToTail( AllocString( pCurPos, -1 ) );
}
return;
}
}
}
示例12: ExcludePathsDlg_Setup
//-----------------------------------------------------------------------------
// ExcludePathsDlg_Setup
//
//-----------------------------------------------------------------------------
void ExcludePathsDlg_Setup( HWND hWnd )
{
TreeView_SetBkColor( GetDlgItem( hWnd, IDC_PATHS_TREE ), g_backgroundColor );
CheckDlgButton( hWnd, IDC_PATHS_LINKGAMEDIRS, g_bLinkGameDirs ? BST_CHECKED : BST_UNCHECKED );
// read the exisiting exclude paths
g_ExcludePaths.Purge();
char szFilename[MAX_PATH];
V_ComposeFileName( g_localPath, EXCLUDEPATHS_FILE, szFilename, sizeof( szFilename ) );
if ( Sys_Exists( szFilename ) )
{
Sys_LoadScriptFile( szFilename );
while ( 1 )
{
char *pToken = Sys_GetToken( true );
if ( !pToken || !pToken[0] )
{
break;
}
Sys_StripQuotesFromToken( pToken );
if ( !stricmp( pToken, "*" ) )
{
pToken = "";
}
else if ( pToken[0] == '\\' )
{
pToken++;
}
char szPath[MAX_PATH];
V_ComposeFileName( ROOT_NAME, pToken, szPath, sizeof( szPath ) );
V_FixSlashes( szPath );
g_ExcludePaths.AddToTail( szPath );
}
}
}
示例13: GetFileList
//-----------------------------------------------------------------------------
// Purpose: Get list of files from current path that match pattern
//-----------------------------------------------------------------------------
int CScriptLib::GetFileList( const char* pDirPath, const char* pPattern, CUtlVector< fileList_t > &fileList )
{
char sourcePath[MAX_PATH];
char fullPath[MAX_PATH];
bool bFindDirs;
fileList.Purge();
strcpy( sourcePath, pDirPath );
int len = (int)strlen( sourcePath );
if ( !len )
{
strcpy( sourcePath, ".\\" );
}
else if ( sourcePath[len-1] != '\\' )
{
sourcePath[len] = '\\';
sourcePath[len+1] = '\0';
}
strcpy( fullPath, sourcePath );
if ( pPattern[0] == '\\' && pPattern[1] == '\0' )
{
// find directories only
bFindDirs = true;
strcat( fullPath, "*" );
}
else
{
// find files, use provided pattern
bFindDirs = false;
strcat( fullPath, pPattern );
}
#ifdef WIN32
struct _finddata_t findData;
intptr_t h = _findfirst( fullPath, &findData );
if ( h == -1 )
{
return 0;
}
do
{
// dos attribute complexities i.e. _A_NORMAL is 0
if ( bFindDirs )
{
// skip non dirs
if ( !( findData.attrib & _A_SUBDIR ) )
continue;
}
else
{
// skip dirs
if ( findData.attrib & _A_SUBDIR )
continue;
}
if ( !stricmp( findData.name, "." ) )
continue;
if ( !stricmp( findData.name, ".." ) )
continue;
char fileName[MAX_PATH];
strcpy( fileName, sourcePath );
strcat( fileName, findData.name );
int j = fileList.AddToTail();
fileList[j].fileName.Set( fileName );
fileList[j].timeWrite = findData.time_write;
}
while ( !_findnext( h, &findData ) );
_findclose( h );
#elif defined(POSIX)
FIND_DATA findData;
Q_FixSlashes( fullPath );
void *h = FindFirstFile( fullPath, &findData );
if ( (int)h == -1 )
{
return 0;
}
do
{
// dos attribute complexities i.e. _A_NORMAL is 0
if ( bFindDirs )
{
// skip non dirs
if ( !( findData.dwFileAttributes & S_IFDIR ) )
continue;
}
else
{
// skip dirs
if ( findData.dwFileAttributes & S_IFDIR )
//.........这里部分代码省略.........
示例14: WipeQueuedEvents
void C_SceneEntity::WipeQueuedEvents()
{
m_QueuedEvents.Purge();
}
示例15: LevelShutdownPreEntity
void CNotifyList::LevelShutdownPreEntity( void )
{
gEntList.RemoveListenerEntity( this );
m_notifyList.Purge();
}