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


C++ idHashIndex::Add方法代码示例

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


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

示例1: SetInternal

/*
============
idCVarSystemLocal::SetInternal
============
*/
void idCVarSystemLocal::SetInternal( const char *name, const char *value, int flags ) {
	int hash;
	idInternalCVar *internal;

	internal = FindInternal( name );

	if ( internal ) {
		internal->InternalSetString( value );
		internal->flags |= flags & ~CVAR_STATIC;
		internal->UpdateCheat();
	} else {
		internal = new idInternalCVar( name, value, flags );
		hash = cvarHash.GenerateKey( internal->nameString.c_str(), false );
		cvarHash.Add( hash, cvars.Append( internal ) );
	}
}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:21,代码来源:CVarSystem.cpp

示例2: RestoreTraceModels

/*
===============
idClipModel::RestoreTraceModels
===============
*/
void idClipModel::RestoreTraceModels( idRestoreGame *savefile ) {
	int i, num;
	ClearTraceModelCache();
	savefile->ReadInt( num );
	traceModelCache.SetNum( num );
	for( i = 0; i < num; i++ ) {
		trmCache_t *entry = new trmCache_t;
		savefile->ReadTraceModel( entry->trm );
		savefile->ReadFloat( entry->volume );
		savefile->ReadVec3( entry->centerOfMass );
		savefile->ReadMat3( entry->inertiaTensor );
		entry->refCount = 0;
		traceModelCache[i] = entry;
		traceModelHash.Add( GetTraceModelHashKey( entry->trm ), i );
	}
}
开发者ID:revelator,项目名称:Revelation-Engine,代码行数:21,代码来源:Clip.cpp

示例3: Register

/*
============
idCVarSystemLocal::Register
============
*/
void idCVarSystemLocal::Register( idCVar *cvar ) {
	int hash;
	idInternalCVar *internal;

	cvar->SetInternalVar( cvar );

	internal = FindInternal( cvar->GetName() );

	if ( internal ) {
		internal->Update( cvar );
	} else {
		internal = new idInternalCVar( cvar );
		hash = cvarHash.GenerateKey( internal->nameString.c_str(), false );
		cvarHash.Add( hash, cvars.Append( internal ) );
	}

	cvar->SetInternalVar( internal );
}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:23,代码来源:CVarSystem.cpp

示例4: AllocTraceModel

/*
===============
idClipModel::AllocTraceModel
===============
*/
int idClipModel::AllocTraceModel( const idTraceModel &trm ) {
	int i, hashKey, traceModelIndex;
	trmCache_t *entry;
	hashKey = GetTraceModelHashKey( trm );
	for( i = traceModelHash.First( hashKey ); i >= 0; i = traceModelHash.Next( i ) ) {
		if( traceModelCache[i]->trm == trm ) {
			traceModelCache[i]->refCount++;
			return i;
		}
	}
	entry = new trmCache_t;
	entry->trm = trm;
	entry->trm.GetMassProperties( 1.0f, entry->volume, entry->centerOfMass, entry->inertiaTensor );
	entry->refCount = 1;
	traceModelIndex = traceModelCache.Append( entry );
	traceModelHash.Add( hashKey, traceModelIndex );
	return traceModelIndex;
}
开发者ID:revelator,项目名称:Revelation-Engine,代码行数:23,代码来源:Clip.cpp

示例5: AddModel

/*
=================
idRenderModelManagerLocal::AddModel
=================
*/
void idRenderModelManagerLocal::AddModel( idRenderModel *model ) {
	hash.Add( hash.GenerateKey( model->Name(), false ), models.Append( model ) );
}
开发者ID:galek,项目名称:fhDOOM,代码行数:8,代码来源:ModelManager.cpp

示例6: AllocTraceModel

/*
===============
idClipModel::AllocTraceModel
===============
*/
int idClipModel::AllocTraceModel( const idTraceModel& trm, bool persistantThroughSaves )
{
	int i, hashKey, traceModelIndex;
	trmCache_t* entry;
	
	hashKey = GetTraceModelHashKey( trm );
	
	if( persistantThroughSaves )
	{
		// Look Inside the saved list.
		for( i = traceModelHash.First( hashKey ); i >= 0; i = traceModelHash.Next( i ) )
		{
			if( traceModelCache[i]->trm == trm )
			{
				traceModelCache[i]->refCount++;
				int flagged_index = i | TRACE_MODEL_SAVED;
				return flagged_index;
			}
		}
	}
	else
	{
	
		// Look inside the unsaved list.
		for( i = traceModelHash_Unsaved.First( hashKey ); i >= 0; i = traceModelHash_Unsaved.Next( i ) )
		{
			if( traceModelCache_Unsaved[i]->trm == trm )
			{
				traceModelCache_Unsaved[i]->refCount++;
				return i;
			}
		}
	}
	
	
	entry = new( TAG_PHYSICS_CLIP ) trmCache_t;
	entry->trm = trm;
	entry->trm.GetMassProperties( 1.0f, entry->volume, entry->centerOfMass, entry->inertiaTensor );
	entry->refCount = 1;
	
	if( persistantThroughSaves )
	{
		traceModelIndex = traceModelCache.Append( entry );
		traceModelHash.Add( hashKey, traceModelIndex );
		
		// Set the saved bit.
		traceModelIndex |= TRACE_MODEL_SAVED;
		
	}
	else
	{
		traceModelIndex = traceModelCache_Unsaved.Append( entry );
		traceModelHash_Unsaved.Add( hashKey, traceModelIndex );
		
		// remove the saved bit
		traceModelIndex &= ~TRACE_MODEL_SAVED;
		
	}
	
	return traceModelIndex;
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:66,代码来源:Clip.cpp


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