当前位置: 首页>>代码示例>>C++>>正文


C++ idList::Num方法代码示例

本文整理汇总了C++中idList::Num方法的典型用法代码示例。如果您正苦于以下问题:C++ idList::Num方法的具体用法?C++ idList::Num怎么用?C++ idList::Num使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在idList的用法示例。


在下文中一共展示了idList::Num方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FreeTraceModel

/*
===============
idClipModel::FreeTraceModel
===============
*/
void idClipModel::FreeTraceModel( int traceModelIndex )
{

	int realTraceModelIndex = traceModelIndex & ~TRACE_MODEL_SAVED;
	
	// Check which cache we are using.
	if( traceModelIndex & TRACE_MODEL_SAVED )
	{
	
		if( realTraceModelIndex < 0 || realTraceModelIndex >= traceModelCache.Num() || traceModelCache[realTraceModelIndex]->refCount <= 0 )
		{
			gameLocal.Warning( "idClipModel::FreeTraceModel: tried to free uncached trace model" );
			return;
		}
		traceModelCache[realTraceModelIndex]->refCount--;
		
	}
	else
	{
	
		if( realTraceModelIndex < 0 || realTraceModelIndex >= traceModelCache_Unsaved.Num() || traceModelCache_Unsaved[realTraceModelIndex]->refCount <= 0 )
		{
			gameLocal.Warning( "idClipModel::FreeTraceModel: tried to free uncached trace model" );
			return;
		}
		traceModelCache_Unsaved[realTraceModelIndex]->refCount--;
		
	}
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:34,代码来源:Clip.cpp

示例2: InsertSyncPoint

/*
========================
idParallelJobList_Threads::InsertSyncPoint
========================
*/
ID_INLINE void idParallelJobList_Threads::InsertSyncPoint( jobSyncType_t syncType )
{
	assert( done );
	switch( syncType )
	{
		case SYNC_SIGNAL:
		{
			assert( !hasSignal );
			if( jobList.Num() )
			{
				assert( !hasSignal );
				signalJobCount.Alloc();
				signalJobCount[signalJobCount.Num() - 1].SetValue( jobList.Num() - lastSignalJob );
				lastSignalJob = jobList.Num();
				job_t& job = jobList.Alloc();
				job.function = Nop;
				job.data = & JOB_SIGNAL;
				hasSignal = true;
			}
			break;
		}
		case SYNC_SYNCHRONIZE:
		{
			if( hasSignal )
			{
				job_t& job = jobList.Alloc();
				job.function = Nop;
				job.data = & JOB_SYNCHRONIZE;
				hasSignal = false;
				numSyncs++;
			}
			break;
		}
	}
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:40,代码来源:ParallelJobList.cpp

示例3: EndLevelLoad

/*
=================
idRenderModelManagerLocal::EndLevelLoad
=================
*/
void idRenderModelManagerLocal::EndLevelLoad() {
	common->Printf( "----- idRenderModelManagerLocal::EndLevelLoad -----\n" );

	int start = Sys_Milliseconds();

	insideLevelLoad = false;
	int	purgeCount = 0;
	int	keepCount = 0;
	int	loadCount = 0;

	// purge any models not touched
	for ( int i = 0 ; i < models.Num() ; i++ ) {
		idRenderModel *model = models[i];

		if ( !model->IsLevelLoadReferenced() && model->IsLoaded() && model->IsReloadable() ) {

//			common->Printf( "purging %s\n", model->Name() );

			purgeCount++;

			R_CheckForEntityDefsUsingModel( model );

			model->PurgeModel();

		} else {

//			common->Printf( "keeping %s\n", model->Name() );

			keepCount++;
		}
	}

	// purge unused triangle surface memory
	R_PurgeTriSurfData( frameData );

	// load any new ones
	for ( int i = 0 ; i < models.Num() ; i++ ) {
		idRenderModel *model = models[i];

		if ( model->IsLevelLoadReferenced() && !model->IsLoaded() && model->IsReloadable() ) {

			loadCount++;
			model->LoadModel();

			if ( ( loadCount & 15 ) == 0 ) {
				session->PacifierUpdate();
			}
		}
	}

	// _D3XP added this
	int	end = Sys_Milliseconds();
	common->Printf( "%5i models purged from previous level, ", purgeCount );
	common->Printf( "%5i models kept.\n", keepCount );
	if ( loadCount ) {
		common->Printf( "%5i new models loaded in %5.1f seconds\n", loadCount, (end-start) * 0.001 );
	}
	common->Printf( "---------------------------------------------------\n" );
}
开发者ID:galek,项目名称:fhDOOM,代码行数:64,代码来源:ModelManager.cpp

示例4: TryWait

/*
========================
idParallelJobList_Threads::TryWait
========================
*/
bool idParallelJobList_Threads::TryWait()
{
	if( jobList.Num() == 0 || signalJobCount[signalJobCount.Num() - 1].GetValue() <= 0 )
	{
		Wait();
		return true;
	}
	return false;
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:14,代码来源:ParallelJobList.cpp

示例5: Submit

/*
========================
idParallelJobList_Threads::Submit
========================
*/
void idParallelJobList_Threads::Submit( idParallelJobList_Threads* waitForJobList, int parallelism )
{
	assert( done );
	assert( numSyncs <= maxSyncs );
	assert( ( unsigned int ) jobList.Num() <= maxJobs + numSyncs * 2 );
	assert( fetchLock.GetValue() == 0 );
	
	done = false;
	currentJob.SetValue( 0 );
	
	memset( &deferredThreadStats, 0, sizeof( deferredThreadStats ) );
	deferredThreadStats.numExecutedJobs = jobList.Num() - numSyncs * 2;
	deferredThreadStats.numExecutedSyncs = numSyncs;
	deferredThreadStats.submitTime = Sys_Microseconds();
	deferredThreadStats.startTime = 0;
	deferredThreadStats.endTime = 0;
	deferredThreadStats.waitTime = 0;
	
	if( jobList.Num() == 0 )
	{
		return;
	}
	
	if( waitForJobList != NULL )
	{
		waitForGuard = & waitForJobList->doneGuards[waitForJobList->currentDoneGuard];
	}
	else
	{
		waitForGuard = NULL;
	}
	
	currentDoneGuard = ( currentDoneGuard + 1 ) & ( NUM_DONE_GUARDS - 1 );
	doneGuards[currentDoneGuard].SetValue( 1 );
	
	signalJobCount.Alloc();
	signalJobCount[signalJobCount.Num() - 1].SetValue( jobList.Num() - lastSignalJob );
	
	job_t& job = jobList.Alloc();
	job.function = Nop;
	job.data = & JOB_LIST_DONE;
	
	if( threaded )
	{
		// hand over to the manager
		void SubmitJobList( idParallelJobList_Threads * jobList, int parallelism );
		SubmitJobList( this, parallelism );
	}
	else
	{
		// run all the jobs right here
		threadJobListState_t state( GetVersion() );
		RunJobs( 0, state, false );
	}
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:60,代码来源:ParallelJobList.cpp

示例6: SaveTraceModels

/*
===============
idClipModel::SaveTraceModels
===============
*/
void idClipModel::SaveTraceModels( idSaveGame *savefile ) {
	int i;
	savefile->WriteInt( traceModelCache.Num() );
	for( i = 0; i < traceModelCache.Num(); i++ ) {
		trmCache_t *entry = traceModelCache[i];
		savefile->WriteTraceModel( entry->trm );
		savefile->WriteFloat( entry->volume );
		savefile->WriteVec3( entry->centerOfMass );
		savefile->WriteMat3( entry->inertiaTensor );
	}
}
开发者ID:revelator,项目名称:Revelation-Engine,代码行数:16,代码来源:Clip.cpp

示例7: RemoveSessionUsersByIDList

/*
========================
idLobby::RemoveSessionUsersByIDList
This is the choke point for removing users from a session.
It will handle all the housekeeping of removing from various platform lists (xsession user tracking, etc).
Called from both host and client.
========================
*/
void idLobby::RemoveSessionUsersByIDList( idList< lobbyUserID_t > & usersToRemoveByID ) {
	assert( lobbyBackend != NULL || usersToRemoveByID.Num() == 0 );

	for ( int i = 0; i < usersToRemoveByID.Num(); i++ ) {
		for ( int u = 0; u < GetNumLobbyUsers(); u++ ) {
			lobbyUser_t * user = GetLobbyUser( u );
			
			if ( user->IsDisconnected() ) {
				// User already disconnected from session  but not removed from the list.
				// This will happen when users are removed during the game.
				continue;
			}
			
			if ( user->lobbyUserID == usersToRemoveByID[i] ) {
				if ( lobbyType == TYPE_GAME ) {
					idLib::Printf( "NET: %s left the game.\n", user->gamertag );
				} else if ( lobbyType == TYPE_PARTY ) {
					idLib::Printf( "NET: %s left the party.\n", user->gamertag );
				}

				UnregisterUser( user );

				// Save the user so we can still get his gamertag, which may be needed for
				// a disconnection HUD message.
				SaveDisconnectedUser( *user );
				FreeUser( user );
				
				break;
			}
		}
	}

	if ( usersToRemoveByID.Num() > 0 && IsHost() ) {
		if ( lobbyBackend != NULL ) {
			lobbyBackend->UpdateLobbySkill( GetAverageSessionLevel() );
		}

		// If we are the host, send a message to all peers with a list of users who have disconnected
		byte buffer[ idPacketProcessor::MAX_MSG_SIZE ];
		idBitMsg msg( buffer, sizeof( buffer ) );
		msg.WriteByte( usersToRemoveByID.Num() );

		for ( int i = 0; i < usersToRemoveByID.Num(); i++ ) {
			usersToRemoveByID[i].WriteToMsg( msg );
		}
		for ( int p = 0; p < peers.Num(); p++ ) {
			QueueReliableMessage( p, RELIABLE_USER_DISCONNECTED, msg.GetReadData(), msg.GetSize() );
		}
	}
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:58,代码来源:sys_lobby_users.cpp

示例8: AddJob

/*
========================
idParallelJobList_Threads::AddJob
========================
*/
ID_INLINE void idParallelJobList_Threads::AddJob( jobRun_t function, void* data )
{
	assert( done );
#if defined( _DEBUG )
	// make sure there isn't already a job with the same function and data in the list
	if( jobList.Num() < 1000 )  	// don't do this N^2 slow check on big lists
	{
		for( int i = 0; i < jobList.Num(); i++ )
		{
			assert( jobList[i].function != function || jobList[i].data != data );
		}
	}
#endif
	if( 1 )    // JDC: this never worked in tech5!  !jobList.IsFull() ) {
	{
		job_t& job = jobList.Alloc();
		job.function = function;
		job.data = data;
		job.executed = 0;
	}
	else
	{
		// debug output to show us what is overflowing
		int currentJobCount[MAX_REGISTERED_JOBS] = {};
		
		for( int i = 0; i < jobList.Num(); ++i )
		{
			const char* jobName = GetJobName( jobList[ i ].function );
			for( int j = 0; j < numRegisteredJobs; ++j )
			{
				if( jobName == registeredJobs[ j ].name )
				{
					currentJobCount[ j ]++;
					break;
				}
			}
		}
		
		// print the quantity of each job type
		for( int i = 0; i < numRegisteredJobs; ++i )
		{
			if( currentJobCount[ i ] > 0 )
			{
				idLib::Printf( "Job: %s, # %d", registeredJobs[ i ].name, currentJobCount[ i ] );
			}
		}
		idLib::Error( "Can't add job '%s', too many jobs %d", GetJobName( function ), jobList.Num() );
	}
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:54,代码来源:ParallelJobList.cpp

示例9: ReloadModels

/*
=================
idRenderModelManagerLocal::ReloadModels
=================
*/
void idRenderModelManagerLocal::ReloadModels( bool forceAll ) {
	if( forceAll ) {
		common->Printf( "Reloading all model files...\n" );
	} else {
		common->Printf( "Checking for changed model files...\n" );
	}
	R_FreeDerivedData();
	// skip the default model at index 0
	for( int i = 1 ; i < models.Num() ; i++ ) {
		idRenderModel	*model = models[i];
		// we may want to allow world model reloading in the future, but we don't now
		if( !model->IsReloadable() ) {
			continue;
		}
		if( !forceAll ) {
			// check timestamp
			ID_TIME_T current;
			fileSystem->ReadFile( model->Name(), NULL, &current );
			if( current <= model->Timestamp() ) {
				continue;
			}
		}
		common->DPrintf( "reloading %s.\n", model->Name() );
		model->LoadModel();
	}
	// we must force the world to regenerate, because models may
	// have changed size, making their references invalid
	R_ReCreateWorldReferences();
}
开发者ID:revelator,项目名称:Revelation,代码行数:34,代码来源:ModelManager.cpp

示例10: CommandCompletion

/*
============
idCVarSystemLocal::CommandCompletion
============
*/
void idCVarSystemLocal::CommandCompletion( void(*callback)( const char *s ) )
{
    for( int i = 0; i < cvars.Num(); i++ )
    {
        callback( cvars[i]->GetName() );
    }
}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:12,代码来源:CVarSystem.cpp

示例11: DrawDebugGraphs

/*
========================
idConsoleLocal::DrawDebugGraphs
========================
*/
void idConsoleLocal::DrawDebugGraphs()
{
	for( int i = 0; i < debugGraphs.Num(); i++ )
	{
		debugGraphs[i]->Render( renderSystem );
	}
}
开发者ID:bsmr-c-cpp,项目名称:RBDOOM-3-BFG,代码行数:12,代码来源:Console.cpp

示例12: FreeTraceModel

/*
===============
idClipModel::FreeTraceModel
===============
*/
void idClipModel::FreeTraceModel( int traceModelIndex ) {
	if ( traceModelIndex < 0 || traceModelIndex >= traceModelCache.Num() || traceModelCache[traceModelIndex]->refCount <= 0 ) {
		gameLocal.Warning( "idClipModel::FreeTraceModel: tried to free uncached trace model" );
		return;
	}
	traceModelCache[traceModelIndex]->refCount--;
}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:12,代码来源:Clip.cpp

示例13: CM_PrecacheModel

clipHandle_t CM_PrecacheModel( const char* Name ) {
	if ( !Name[ 0 ] ) {
		common->Error( "CM_ForName: NULL name" );
	}

	//
	// search the currently loaded models
	//
	for ( int i = 0; i < CMNonMapModels.Num(); i++ ) {
		if ( CMNonMapModels[ i ]->Name == Name ) {
			return ( i + 1 ) << CMH_NON_MAP_SHIFT;
		}
	}

	//
	// load the file
	//
	idList<quint8> Buffer;
	if ( FS_ReadFile( Name, Buffer ) <= 0 ) {
		common->Error( "CM_PrecacheModel: %s not found", Name );
	}

	// call the apropriate loader
	switch ( LittleLong( *( unsigned* )Buffer.Ptr() ) ) {
	case BSP29_VERSION:
	{
		QClipMap* LoadCMap = CM_CreateQClipMap29();
		CMNonMapModels.Append( LoadCMap );
		LoadCMap->LoadMap( Name, Buffer );
		if ( LoadCMap->GetNumInlineModels() > 1 ) {
			common->Printf( "Non-map BSP models are not supposed to have submodels\n" );
		}
		break;
	}

	default:
	{
		QClipMapNonMap* LoadCMap = new QClipMapNonMap;
		CMNonMapModels.Append( LoadCMap );

		LoadCMap->LoadMap( Name, Buffer );
	}
	}

	return CMNonMapModels.Num() << CMH_NON_MAP_SHIFT;
}
开发者ID:janisl,项目名称:jlquake,代码行数:46,代码来源:non_map.cpp

示例14:

int	Sys_ReturnJoystickInputEvent( const int n, int &action, int &value ) {
	if (n >= joystick_polls.Num())
		return 0;

	action = joystick_polls[n].action;
	value = joystick_polls[n].value;
	return 1;
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:8,代码来源:events.cpp

示例15: WriteFlaggedVariables

/*
============
idCVarSystemLocal::WriteFlaggedVariables

Appends lines containing "set variable value" for all variables
with the "flags" flag set to true.
============
*/
void idCVarSystemLocal::WriteFlaggedVariables( int flags, const char *setCmd, idFile *f ) const {
	for( int i = 0; i < cvars.Num(); i++ ) {
		idInternalCVar *cvar = cvars[i];
		if ( cvar->GetFlags() & flags ) {
			f->Printf( "%s %s \"%s\"\n", setCmd, cvar->GetName(), cvar->GetString() );
		}
	}
}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:16,代码来源:CVarSystem.cpp


注:本文中的idList::Num方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。