本文整理汇总了C++中CUtlVector::AddToTail方法的典型用法代码示例。如果您正苦于以下问题:C++ CUtlVector::AddToTail方法的具体用法?C++ CUtlVector::AddToTail怎么用?C++ CUtlVector::AddToTail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtlVector
的用法示例。
在下文中一共展示了CUtlVector::AddToTail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
void CSDK_Loading_Panel::Init( void )
{
m_pBackdrop = new vgui::ImagePanel( this, "LoadingImage" );
m_pBackdrop->SetShouldScaleImage( true );
m_pBlackBar[0] = new vgui::Panel( this, "LoadingImageBlackBar0" );
m_pBlackBar[1] = new vgui::Panel( this, "LoadingImageBlackBar1" );
m_pDetailsPanel = new LoadingMissionDetailsPanel( this, "LoadingMissionDetailsPanel" );
m_pDetailsPanel->SetProportional( true );
m_pDetailsPanel->SetVisible( false );
// choose pic
static char pics[14][64] = {
"console/hl2wars_bg1_widescreen",
/*
//"swarm/loading/Loading_Vereon",
"swarm/loading/Loading_Labs1",
"swarm/loading/Loading_Labs2",
"swarm/loading/Loading_LandingBay",
"swarm/loading/Loading_Mine1",
"swarm/loading/Loading_Mine2",
"swarm/loading/Loading_Mine3",
"swarm/loading/Loading_Office",
"swarm/loading/Loading_Plant1",
"swarm/loading/Loading_Plant2",
"swarm/loading/Loading_Plant3",
"swarm/loading/Loading_Sewers1",
"swarm/loading/Loading_Sewers2",
"swarm/loading/Loading_Sewers3",
"swarm/loading/Loading_Sewers4"*/
};
int iChosen = RandomInt(0,13);
Q_snprintf(m_szLoadingPic, sizeof(m_szLoadingPic), pics[iChosen]);
ListenForGameEvent( "server_spawn" );
g_vecLoadingPanels.AddToTail( this );
}
示例2: FindHints
int CASW_Marine_Hint_Manager::FindHints(const Vector &position, CASW_Marine *pLeader, const float flMinDistance, const float flMaxDistance, CUtlVector<HintData_t *> &result)
{
VPROF_BUDGET("CASW_Marine_Hint_Manager::FindHints", "SquadFormation");
Assert(pLeader);
const float flMinDistSqr = Square(flMinDistance);
const float flMaxDistSqr = Square(flMaxDistance);
int nCount = m_Hints.Count();
for ( int i = 0; i < nCount; i++ )
{
HintData_t *pHint = m_Hints[i];
float flDistSqr = position.DistToSqr(pHint->m_vecPosition);
if (flDistSqr < flMinDistSqr || flDistSqr > flMaxDistSqr)
{
continue;
}
AI_Waypoint_t *pPath = pLeader->GetPathfinder()->BuildRoute(position, pHint->m_vecPosition, NULL, 0, NAV_GROUND, bits_BUILD_NO_LOCAL_NAV);
if (!pPath)
{
continue;
}
pHint->m_flDistance = position.DistTo(pPath->GetPos());
AI_Waypoint_t *pCur = pPath;
while (pCur->GetNext())
{
AI_Waypoint_t *pNext = pCur->GetNext();
pHint->m_flDistance += pCur->GetPos().DistTo(pNext->GetPos());
pCur = pNext;
}
DeleteAll(pPath);
if (pHint->m_flDistance > flMaxDistance)
{
continue;
}
result.AddToTail( pHint );
}
return result.Count();
}
示例3: GetSelectionCenter
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Vector CEditorSystem::GetSelectionCenter()
{
if ( !IsAnythingSelected() )
{
Assert( 0 );
return vec3_origin;
}
if ( m_bSelectionCenterLocked )
return m_vecSelectionCenterCache;
CUtlVector< Vector > positions;
FOR_EACH_VEC( m_hSelectedEntities, i )
{
if( !m_hSelectedEntities[ i ] )
continue;
positions.AddToTail( m_hSelectedEntities[ i ]->GetAbsOrigin() );
}
if( positions.Count() == 0 )
{
return m_vecSelectionCenterCache;
}
#if 1 // median
Vector min, max;
CalcBoundaries( positions.Base(), positions.Count(), min, max );
return min + ( max - min ) * 0.5f;
#else // arth mean
Vector center = vec3_origin;
FOR_EACH_VEC( positions, i )
center += positions[ i ];
return center / positions.Count();
#endif
}
示例4: AppendNodes
void virtualmodel_t::AppendNodes( int group, const studiohdr_t *pStudioHdr )
{
AUTO_LOCK_( CThreadTerminalMutex<CThreadFastMutex>, m_Lock );
int numCheck = m_node.Count();
CUtlVector< virtualgeneric_t > node;
node = m_node;
MEM_ALLOC_CREDIT();
int j, k;
m_group[ group ].masterNode.SetCount( pStudioHdr->numlocalnodes );
for (j = 0; j < pStudioHdr->numlocalnodes; j++)
{
char *s1 = pStudioHdr->pszLocalNodeName( j );
for (k = 0; k < numCheck; k++)
{
char *s2 = m_group[ node[k].group ].GetStudioHdr()->pszLocalNodeName( node[k].index );
if (stricmp( s1, s2 ) == 0)
{
break;
}
}
// no duplication
if (k == numCheck)
{
virtualgeneric_t tmp;
tmp.group = group;
tmp.index = j;
k = node.AddToTail( tmp );
}
m_group[ group ].masterNode[ j ] = k;
}
m_node = node;
}
示例5: BuildFacialControlList
//-----------------------------------------------------------------------------
// Builds the list of all controls in the animation set contributing to facial animation
//-----------------------------------------------------------------------------
void CSFMGenApp::BuildFacialControlList( CDmeFilmClip *pShot, CDmeAnimationSet *pAnimationSet, CUtlVector< LogPreview_t > &list )
{
const CDmaElementArray< CDmElement > &controls = pAnimationSet->GetControls();
int nCount = controls.Count();
for ( int i = 0; i < nCount; ++i )
{
CDmElement *pControl = controls[i];
if ( !pControl || pControl->GetValue<bool>( "transform" ) )
continue;
LogPreview_t preview;
preview.m_hControl = pControl;
preview.m_hShot = pShot;
preview.m_bActiveLog = preview.m_bSelected = false;
if ( pControl->GetValue< bool >( "combo" ) )
{
preview.m_hChannels[ LOG_PREVIEW_VALUE ] = pControl->GetValueElement< CDmeChannel >( "valuechannel" );
preview.m_hChannels[ LOG_PREVIEW_BALANCE ] = pControl->GetValueElement< CDmeChannel >( "balancechannel" );
}
else
{
preview.m_hChannels[ LOG_PREVIEW_VALUE ] = pControl->GetValueElement< CDmeChannel >( "channel" );
preview.m_hChannels[ LOG_PREVIEW_BALANCE ] = NULL;
}
if ( pControl->GetValue< bool >( "multi" ) )
{
preview.m_hChannels[ LOG_PREVIEW_MULTILEVEL ] = pControl->GetValueElement< CDmeChannel >( "multilevelchannel" );
}
else
{
preview.m_hChannels[ LOG_PREVIEW_MULTILEVEL ] = NULL;
}
preview.m_hOwner = preview.m_hChannels[ LOG_PREVIEW_VALUE ]->FindOwnerClipForChannel( pShot );
list.AddToTail( preview );
}
}
示例6: ConvertWorldBrushesToPhysCollide
static void ConvertWorldBrushesToPhysCollide( CUtlVector<CPhysCollisionEntry *> &collisionList, float shrinkSize, float mergeTolerance, int contentsMask )
{
CPlaneList planes( shrinkSize, mergeTolerance );
planes.m_contentsMask = contentsMask;
VisitLeaves_r( planes, dmodels[0].headnode );
planes.AddBrushes();
int count = planes.m_convex.Count();
if ( count )
{
CPhysCollide *pCollide = physcollision->ConvertConvexToCollide( planes.m_convex.Base(), count );
ICollisionQuery *pQuery = physcollision->CreateQueryModel( pCollide );
int convex = pQuery->ConvexCount();
for ( int i = 0; i < convex; i++ )
{
int triCount = pQuery->TriangleCount( i );
int brushIndex = pQuery->GetGameData( i );
Vector points[3];
for ( int j = 0; j < triCount; j++ )
{
pQuery->GetTriangleVerts( i, j, points );
Vector normal = TriangleNormal( points[0], points[1], points[2] );
dbrushside_t *pside = FindBrushSide( brushIndex, normal );
if ( pside->texinfo != TEXINFO_NODE )
{
int prop = g_SurfaceProperties[texinfo[pside->texinfo].texdata];
pQuery->SetTriangleMaterialIndex( i, j, RemapWorldMaterial( prop ) );
}
}
}
physcollision->DestroyQueryModel( pQuery );
pQuery = NULL;
collisionList.AddToTail( new CPhysCollisionEntryStaticSolid( pCollide, contentsMask ) );
}
}
示例7:
//-----------------------------------------------------------------------------
// Purpose: Calls the autocompletion method to get autocompletion suggestions
//-----------------------------------------------------------------------------
int ConCommand::AutoCompleteSuggest( const char *partial, CUtlVector< CUtlString > &commands )
{
if ( m_bUsingCommandCallbackInterface )
{
if ( !m_pCommandCompletionCallback )
return 0;
return m_pCommandCompletionCallback->CommandCompletionCallback( partial, commands );
}
Assert( m_fnCompletionCallback );
if ( !m_fnCompletionCallback )
return 0;
char rgpchCommands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ];
int iret = ( m_fnCompletionCallback )( partial, rgpchCommands );
for ( int i = 0 ; i < iret; ++i )
{
CUtlString str = rgpchCommands[ i ];
commands.AddToTail( str );
}
return iret;
}
示例8: ShotgunImpactSoundGroup
// Called by the ImpactSound function.
void ShotgunImpactSoundGroup( const char *pSoundName, const Vector &vEndPos )
{
// Don't play the sound if it's too close to another impact sound.
for ( int i=0; i < g_GroupedSounds.Count(); i++ )
{
CGroupedSound *pSound = &g_GroupedSounds[i];
if ( vEndPos.DistToSqr( pSound->m_vPos ) < 300*300 )
{
if ( Q_stricmp( pSound->m_SoundName, pSoundName ) == 0 )
return;
}
}
// Ok, play the sound and add it to the list.
CLocalPlayerFilter filter;
C_BaseEntity::EmitSound( filter, NULL, pSoundName, &vEndPos );
int j = g_GroupedSounds.AddToTail();
g_GroupedSounds[j].m_SoundName = pSoundName;
g_GroupedSounds[j].m_vPos = vEndPos;
}
示例9: AddEntity
//---------------------------------------------------------
//---------------------------------------------------------
void CVisibilityMonitor::AddEntity( CBaseEntity *pEntity, float flMinDist, VisibilityMonitorCallback pfnCallback, VisibilityMonitorEvaluator pfnEvaluator )
{
Assert( pEntity != NULL );
if( !IsTrackingEntity( pEntity ) )
{
visibility_target_t newTarget;
newTarget.entity = pEntity;
newTarget.minDistSqr = Square(flMinDist);
newTarget.memory = NO_VISIBILITY_MEMORY;
newTarget.pfnCallback = pfnCallback;
newTarget.pfnEvaluator = pfnEvaluator;
m_Entities.AddToTail( newTarget );
if( debug_visibility_monitor.GetBool() )
{
Msg("VisMon: Added Entity: %s (%s)\n", pEntity->GetClassname(), pEntity->GetDebugName() );
}
}
}
示例10: PickSpawnersRandomly
// picks a number of spawners randomly from this spawngroup
void CASW_Spawn_Group::PickSpawnersRandomly( int nNumSpawners, bool bIncludeRecentlySpawned, CUtlVector< CASW_Base_Spawner* > *pSpawners )
{
pSpawners->RemoveAll();
CUtlVector< CASW_Base_Spawner* > candidates;
for ( int i = 0; i < m_hSpawners.Count(); i++ )
{
if ( !m_hSpawners[i].Get() || !m_hSpawners[i]->IsEnabled() )
continue;
if ( !bIncludeRecentlySpawned && m_hSpawners[i]->HasRecentlySpawned() )
continue;
candidates.AddToTail( m_hSpawners[i].Get() );
}
for ( int i = 0; ( (i < nNumSpawners) && (candidates.Count() > 0) ); i++ )
{
int nChosen = RandomInt( 0, candidates.Count() - 1 );
pSpawners->AddToTail( candidates[ nChosen ] );
candidates.Remove( nChosen );
}
}
示例11: RestoreSoundPatch
//-----------------------------------------------------------------------------
// Restores the sound patch + associated commands
//-----------------------------------------------------------------------------
void CSoundControllerImp::RestoreSoundPatch( CSoundPatch **ppSoundPatch, IRestore *pRestore )
{
CSoundPatch *pPatch = new CSoundPatch;
// read the sound patch data from the memory block
pRestore->StartBlock();
bool bOk = ( pRestore->ReadAll( pPatch ) != 0 );
pRestore->EndBlock();
bOk = (bOk && pPatch->IsPlaying()) ? true : false;
if (bOk)
{
m_soundList.AddToTail( pPatch );
}
// Count the number of commands that refer to the sound patch
pRestore->StartBlock();
if ( bOk )
{
int nCount;
pRestore->ReadInt( &nCount );
while ( --nCount >= 0 )
{
SoundCommand_t *pCommand = new SoundCommand_t;
pRestore->StartBlock();
if ( pRestore->ReadAll( pCommand ) )
{
CommandInsert( pCommand );
}
pRestore->EndBlock();
}
}
pRestore->EndBlock();
*ppSoundPatch = pPatch;
}
示例12: Shake
//-----------------------------------------------------------------------------
// Purpose: Message hook to parse ScreenShake messages
// Input : pszName -
// iSize -
// pbuf -
// Output :
//-----------------------------------------------------------------------------
void CViewEffects::Shake( ScreenShake_t &data )
{
if ( ( data.command == SHAKE_START || data.command == SHAKE_START_RUMBLEONLY ) && ( m_ShakeList.Count() < MAX_SHAKES ) )
{
screenshake_t *pNewShake = new screenshake_t;
pNewShake->amplitude = data.amplitude;
pNewShake->frequency = data.frequency;
pNewShake->duration = data.duration;
pNewShake->nextShake = 0;
pNewShake->endtime = gpGlobals->curtime + data.duration;
pNewShake->command = data.command;
m_ShakeList.AddToTail( pNewShake );
}
else if ( data.command == SHAKE_STOP)
{
ClearAllShakes();
}
else if ( data.command == SHAKE_AMPLITUDE )
{
// Look for the most likely shake to modify.
screenshake_t *pShake = FindLongestShake();
if ( pShake )
{
pShake->amplitude = data.amplitude;
}
}
else if ( data.command == SHAKE_FREQUENCY )
{
// Look for the most likely shake to modify.
screenshake_t *pShake = FindLongestShake();
if ( pShake )
{
pShake->frequency = data.frequency;
}
}
}
示例13: Cubemap_AddUnreferencedCubemaps
// Populate with cubemaps that were skipped
void Cubemap_AddUnreferencedCubemaps()
{
char pTextureName[1024];
char pFileName[1024];
PatchInfo_t info;
dcubemapsample_t *pSample;
int i,j;
for ( i=0; i<g_nCubemapSamples; ++i )
{
pSample = &g_CubemapSamples[i];
// generate the formatted texture name based on cubemap origin
info.m_pMapName = mapbase;
info.m_pOrigin[0] = pSample->origin[0];
info.m_pOrigin[1] = pSample->origin[1];
info.m_pOrigin[2] = pSample->origin[2];
GeneratePatchedName( "c", info, false, pTextureName, 1024 );
// find or add
for ( j=0; j<s_DefaultCubemapNames.Count(); ++j )
{
if ( !stricmp( s_DefaultCubemapNames[j], pTextureName ) )
{
// already added
break;
}
}
if ( j == s_DefaultCubemapNames.Count() )
{
int nLen = Q_snprintf( pFileName, 1024, "materials/%s.vtf", pTextureName );
int id = s_DefaultCubemapNames.AddToTail();
s_DefaultCubemapNames[id] = new char[nLen + 1];
strcpy( s_DefaultCubemapNames[id], pFileName );
}
}
}
示例14: FillGraph
void CJobWatchDlg::FillGraph()
{
// Get all the graph samples.
unsigned long jobWorkerID;
if ( !GetCurJobWorkerID( jobWorkerID ) )
return;
CMySQLQuery query;
query.Format( "select * from graph_entry where JobWorkerID=%lu", jobWorkerID );
GetMySQL()->Execute( query );
int iMSTime = GetMySQL()->GetColumnIndex( "MSSinceJobStart" );
int iBytesSent = GetMySQL()->GetColumnIndex( "BytesSent" );
int iBytesReceived = GetMySQL()->GetColumnIndex( "BytesReceived" );
// See if there's anything new.
CUtlVector<CGraphEntry> entries;
int highest = m_CurGraphTime;
while ( GetMySQL()->NextRow() )
{
CGraphEntry entry;
entry.m_msTime = GetMySQL()->GetColumnValue( iMSTime ).Int32();
entry.m_nBytesSent = GetMySQL()->GetColumnValue( iBytesSent ).Int32();
entry.m_nBytesReceived = GetMySQL()->GetColumnValue( iBytesReceived ).Int32();
entries.AddToTail( entry );
highest = max( highest, entry.m_msTime );
}
if ( highest > m_CurGraphTime )
{
m_CurGraphTime = highest;
m_GraphControl.Clear();
m_GraphControl.Fill( entries );
}
}
示例15: 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 );
}
}
}