本文整理汇总了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 ) );
}
}
示例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 );
}
}
示例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 );
}
示例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;
}
示例5: AddModel
/*
=================
idRenderModelManagerLocal::AddModel
=================
*/
void idRenderModelManagerLocal::AddModel( idRenderModel *model ) {
hash.Add( hash.GenerateKey( model->Name(), false ), models.Append( model ) );
}
示例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;
}