本文整理汇总了C++中idList::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ idList::Append方法的具体用法?C++ idList::Append怎么用?C++ idList::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idList
的用法示例。
在下文中一共展示了idList::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSaveGameList
/*
===============
idSessionLocal::GetSaveGameList
===============
*/
void idSessionLocal::GetSaveGameList( idStrList &fileList, idList<fileTIME_T> &fileTimes ) {
int i;
idFileList *files;
// NOTE: no fs_game_base for savegames
idStr game = cvarSystem->GetCVarString( "fs_game" );
if( game.Length() ) {
files = fileSystem->ListFiles( "savegames", ".save", false, false, game );
} else {
files = fileSystem->ListFiles( "savegames", ".save" );
}
fileList = files->GetList();
fileSystem->FreeFileList( files );
for ( i = 0; i < fileList.Num(); i++ ) {
ID_TIME_T timeStamp;
fileSystem->ReadFile( "savegames/" + fileList[i], NULL, &timeStamp );
fileList[i].StripLeading( '/' );
fileList[i].StripFileExtension();
fileTIME_T ft;
ft.index = i;
ft.timeStamp = timeStamp;
fileTimes.Append( ft );
}
fileTimes.Sort( idListSaveGameCompare );
}
示例2: InitScriptEvents
/*
================
DialogScriptEditor::InitScriptEvents
================
*/
void DialogScriptEditor::InitScriptEvents( void ) {
int index;
idParser src;
idToken token;
idStr whiteSpace;
scriptEventInfo_t info;
if( !src.LoadFile( "script/doom_events.script" ) ) {
return;
}
scriptEvents.Clear();
while( src.ReadToken( &token ) ) {
if( token == "scriptEvent" ) {
src.GetLastWhiteSpace( whiteSpace );
index = whiteSpace.Find( "//" );
if( index != -1 ) {
info.help = whiteSpace.Right( whiteSpace.Length() - index );
info.help.Remove( '\r' );
info.help.Replace( "\n", "\r\n" );
} else {
info.help = "";
}
src.ExpectTokenType( TT_NAME, 0, &token );
info.parms = token;
src.ExpectTokenType( TT_NAME, 0, &token );
info.name = token;
src.ExpectTokenString( "(" );
info.parms += " " + info.name + "(";
while( src.ReadToken( &token ) && token != ";" ) {
info.parms.Append( " " + token );
}
scriptEvents.Append( info );
}
}
}
示例3: ParseIndex
/*
================
idAASFileLocal::ParseIndex
================
*/
bool idAASFileLocal::ParseIndex( idLexer &src, idList<aasIndex_t> &indexes )
{
int numIndexes, i;
aasIndex_t index;
numIndexes = src.ParseInt();
indexes.Resize( numIndexes );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numIndexes; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
index = src.ParseInt();
src.ExpectTokenString( ")" );
indexes.Append( index );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例4: PushButton
void PushButton( int key, bool value ) {
// So we don't keep sending the same SE_KEY message over and over again
if ( buttonStates[key] != value ) {
buttonStates[key] = value;
sysEvent_t res = { SE_KEY, key, value ? 1 : 0, 0, NULL };
event_overflow.Append(res);
}
}
示例5: 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;
}
示例6: ParseInOutStruct
/*
========================
ParseInOutStruct
========================
*/
void ParseInOutStruct( idLexer & src, int attribType, idList< inOutVariable_t > & inOutVars ) {
src.ExpectTokenString( "{" );
while( !src.CheckTokenString( "}" ) ) {
inOutVariable_t var;
idToken token;
src.ReadToken( &token );
var.type = token;
src.ReadToken( &token );
var.nameCg = token;
if ( !src.CheckTokenString( ":" ) ) {
src.SkipUntilString( ";" );
continue;
}
src.ReadToken( &token );
var.nameGLSL = token;
src.ExpectTokenString( ";" );
// convert the type
for ( int i = 0; typeConversion[i].typeCG != NULL; i++ ) {
if ( var.type.Cmp( typeConversion[i].typeCG ) == 0 ) {
var.type = typeConversion[i].typeGLSL;
break;
}
}
// convert the semantic to a GLSL name
for ( int i = 0; attribsPC[i].semantic != NULL; i++ ) {
if ( ( attribsPC[i].flags & attribType ) != 0 ) {
if ( var.nameGLSL.Cmp( attribsPC[i].semantic ) == 0 ) {
var.nameGLSL = attribsPC[i].glsl;
break;
}
}
}
// check if it was defined previously
var.declareInOut = true;
for ( int i = 0; i < inOutVars.Num(); i++ ) {
if ( var.nameGLSL == inOutVars[i].nameGLSL ) {
var.declareInOut = false;
break;
}
}
inOutVars.Append( var );
}
src.ExpectTokenString( ";" );
}
示例7: BufferCommandArgs
/*
============
idCmdSystemLocal::BufferCommandArgs
============
*/
void idCmdSystemLocal::BufferCommandArgs( cmdExecution_t exec, const idCmdArgs &args ) {
switch ( exec ) {
case CMD_EXEC_NOW: {
ExecuteTokenizedString( args );
break;
}
case CMD_EXEC_APPEND: {
AppendCommandText( "_execTokenized\n" );
tokenizedCmds.Append( args );
break;
}
default: {
common->FatalError( "idCmdSystemLocal::BufferCommandArgs: bad exec type" );
}
}
}
示例8: 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 ) );
}
}
示例9: 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 );
}
示例10: 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;
}
示例11: FindSkeletalMeshes
/*
=================
idRenderModelManagerLocal::FindSkeletalMeshes
=================
*/
void idRenderModelManagerLocal::FindSkeletalMeshes( idList<idStr> &skeletalMeshes ) {
const idDecl *decl;
skeletalMeshes.Clear();
for(int i = 0; i < declManager->GetNumDecls( DECL_MODELDEF ); i++)
{
decl = declManager->DeclByIndex( DECL_MODELDEF, i, false );
// This probley isn't the best way to do this, just check to see if the decl def has the skeletal model extension.
char *text = (char *)_alloca( decl->GetTextLength() + 1 );
decl->GetText( text );
if(!strstr(text, ".md5mesh"))
{
_resetstkoflw();
continue;
}
_resetstkoflw();
skeletalMeshes.Append( decl->GetName() );
}
}
示例12: GetValidEntitiesInside
//
// GetValidEntitiesInside()
//
void hhReactionVolume::GetValidEntitiesInside(idList<idEntity*> &outValidEnts) {
assert(GetPhysics() != NULL);
assert(flags != 0); // have to be looking for something - else whats the point?
idEntity * entityList[ MAX_GENTITIES ];
int numEnts = gameLocal.clip.EntitiesTouchingBounds(GetPhysics()->GetAbsBounds(), CONTENTS_BODY, entityList, MAX_GENTITIES);
for(int i=0;i<numEnts;i++) {
if(!entityList[i] || entityList[i]->IsHidden())
continue;
if(flags & flagPlayers && entityList[i]->IsType(hhPlayer::Type)) {
outValidEnts.Append(entityList[i]);
if(ai_debugBrain.GetInteger()) {
gameRenderWorld->DebugArrow(colorMagenta, GetOrigin(), entityList[i]->GetOrigin(), 10, 1000);
}
continue;
}
}
if(ai_debugBrain.GetInteger()) {
gameRenderWorld->DebugBounds(colorWhite, GetPhysics()->GetBounds(), GetOrigin(), 1000);
}
}
示例13: GetTopLifeStats
/*
============
sdStatsTracker::GetTopLifeStats
============
*/
void sdStatsTracker::GetTopLifeStats( idList< const lifeStatsData_t* >& improved,
idList< const lifeStatsData_t* >& unchanged,
idList< const lifeStatsData_t* >& worse ) const {
improved.SetNum( 0, false );
unchanged.SetNum( 0, false );
worse.SetNum( 0, false );
for( int i = 0; i < lifeStatsData.Num(); i++ ) {
const lifeStatsData_t& data = lifeStatsData[ i ];
switch ( data.newValue.GetType() ) {
case sdNetStatKeyValue::SVT_FLOAT:
case sdNetStatKeyValue::SVT_FLOAT_MAX:
if ( data.newValue.GetFloat() > data.oldValue.GetFloat() ) {
improved.Append( &data );
} else if( idMath::Fabs( data.newValue.GetFloat() - data.oldValue.GetFloat() ) < STATS_EPSILON ) {
unchanged.Append( &data );
} else {
worse.Append( &data );
}
break;
case sdNetStatKeyValue::SVT_INT:
case sdNetStatKeyValue::SVT_INT_MAX:
if ( data.newValue.GetInt() > data.oldValue.GetInt() ) {
improved.Append( &data );
} else if( data.newValue.GetInt() == data.oldValue.GetInt() ) {
unchanged.Append( &data );
} else {
worse.Append( &data );
}
break;
default:
assert( false );
break;
}
}
sdQuickSort( improved.Begin(), improved.End(), sdSortPercentageImprovement() );
}
示例14: GetNextDebrisData
/*
============
hhDebrisSpawner::GetNextDebrisData
============
*/
bool hhDebrisSpawner::GetNextDebrisData( idList<idStr> &entityDefs, int &count, const idKeyValue * &kv, idVec3 &origin, idAngles &angle ) {
static char debrisDef[] = "def_debris";
static char debrisKey[] = "debris";
idStr indexStr;
idStr entityDefBase;
int numDebris, minDebris, maxDebris;
origin = vec3_zero;
// Loop through looking for the next valid debris key
for ( kv = spawnArgs.MatchPrefix( debrisDef, kv );
kv && kv->GetValue().Length();
kv = spawnArgs.MatchPrefix( debrisDef, kv ) ) {
indexStr = kv->GetKey();
indexStr.Strip( debrisDef );
// Is a valid debris base And it isn't a variation. (ie, contains a .X postfix)
if ( idStr::IsNumeric( indexStr ) && indexStr.Find( '.' ) < 0 ) {
// Get Number of Debris
numDebris = -1;
if ( sourceEntity && sourceEntity->IsType( idAI::Type ) ) {
idVec3 bonePos;
idMat3 boneAxis;
idStr bone = spawnArgs.GetString( va( "%s%s%s", debrisKey, "_bone", ( const char * ) indexStr ) );
if( !bone.IsEmpty() ) {
static_cast<idAI*>(sourceEntity)->GetJointWorldTransform( bone.c_str(), bonePos, boneAxis );
origin = bonePos;
angle = spawnArgs.GetAngles( va( "%s%s%s", debrisKey, "_angle", ( const char * ) indexStr ) );
}
}
if ( !spawnArgs.GetInt( va( "%s%s%s", debrisKey, "_num",
( const char * ) indexStr ),
"-1", numDebris ) || numDebris < 0 ) {
// No num found, look for min and max
if ( spawnArgs.GetInt( va( "%s%s%s", debrisKey, "_min",
( const char * ) indexStr ),
"-1", minDebris ) && minDebris >= 0 &&
spawnArgs.GetInt( va( "%s%s%s", debrisKey, "_max",
( const char * ) indexStr ),
"-1", maxDebris ) && maxDebris >= 0 ) {
numDebris =
gameLocal.random.RandomInt( ( maxDebris - minDebris ) ) + minDebris;
} //. No min/max found
} //. No num found
// No valid num found
if ( numDebris < 0 ) {
gameLocal.Warning( "ERROR: No debris num could be be found for %s%s",
( const char * ) debrisDef,
( const char * ) indexStr );
}
else { // Valid num found
const char * entityDefPrefix;
const idKeyValue * otherDefKey = NULL;
entityDefBase = kv->GetValue();
count = numDebris;
entityDefs.Append( entityDefBase );
// Find the other defs that may be there. using .X scheme
entityDefPrefix = va( "%s.", (const char *) kv->GetKey() );
// gameLocal.Printf( "Looking for %s\n", entityDefPrefix );
for ( otherDefKey = spawnArgs.MatchPrefix( entityDefPrefix, otherDefKey );
otherDefKey && otherDefKey->GetValue().Length();
otherDefKey = spawnArgs.MatchPrefix( entityDefPrefix, otherDefKey ) ) {
// gameLocal.Printf( "Would have added %s\n", (const char *) otherDefKey->GetValue() );
entityDefs.Append( otherDefKey->GetValue() );
}
return( true );
}
} //. Valid debris base
} //. debris loop
return( false );
}
示例15: R_LoadPreprocessed
static idStr R_LoadPreprocessed( const idStr& filename, idList<idStr>& previoulsyLoadedFiles, idList<idStr>& includeStack ) {
includeStack.Append( filename );
previoulsyLoadedFiles.Append( filename );
const int fileIndex = previoulsyLoadedFiles.Num() - 1;
idStr content = R_ReadFile(filename.c_str());
idStr ret;
fhStrRef ptr = fhStrRef( content.c_str(), content.Length() );
fhStrRef remaining = ptr;
int currentLine = 1;
int currentColumn = 1;
bool isLineComment = false;
for (; !ptr.IsEmpty(); ++ptr) {
if (ptr[0] == '\n') {
++currentLine;
currentColumn = 1;
isLineComment = false;
continue;
}
if (isLineComment) {
continue;
}
if (ptr.StartsWith( "//" )) {
isLineComment = true;
continue;
}
static const fhStrRef includeDirective = "#include \"";
if (currentColumn == 1 && ptr.StartsWith( includeDirective )) {
fhStrRef includeFilename = ptr.Substr( includeDirective.Length() );
for (int i = 0; i < includeFilename.Length() + 1; ++i) {
if (i == includeFilename.Length())
throw fhParseException( filename, currentLine, currentColumn, "unexpected end-of-file in preprocessor include" );
if (includeFilename[i] == '\n')
throw fhParseException( filename, currentLine, currentColumn, "unexpected end-of-line in preprocessor include" );
if (includeFilename[i] == '"') {
includeFilename = includeFilename.Substr( 0, i );
break;
}
}
if (includeFilename.IsEmpty())
throw fhParseException( filename, currentLine, currentColumn, "empty filename in preprocessor include" );
if (includeStack.FindIndex( includeFilename.ToString() ) >= 0)
throw fhParseException( filename, currentLine, currentColumn, "circular preprocessor include" );
idStr includeContent;
//try to load included shader relative to current file. If that fails try to load included shader from root directory.
try {
idStr includeFilePath;
filename.ExtractFilePath(includeFilePath);
includeFilePath.AppendPath( includeFilename.c_str(), includeFilename.Length() );
includeContent = R_LoadPreprocessed( includeFilePath, previoulsyLoadedFiles, includeStack );
ret.Append( remaining.c_str(), ptr.c_str() - remaining.c_str() );
ret.Append( includeContent );
//ret.Append( "\n#line " + toString( currentLine + 1 ) + " \"" + filename + "\"" );
} catch (const fhFileNotFoundException& e) {
try {
includeContent = R_LoadPreprocessed( includeFilename.ToString(), previoulsyLoadedFiles, includeStack );
ret.Append( remaining.c_str(), ptr.c_str() - remaining.c_str() );
ret.Append( includeContent );
//ret.append( "\n#line " + ToString( currentLine + 1 ) + " \"" + filename + "\"" );
} catch (const fhFileNotFoundException& e) {
throw fhParseException( filename, currentLine, currentColumn, idStr( "include file not found: " ) + includeFilename.ToString() );
}
}
//skip rest of the line
while (!ptr.IsEmpty() && ptr[0] != '\n') {
++ptr;
}
++currentLine;
currentColumn = 1;
remaining = ptr;
continue;
}
currentColumn++;
}
ret.Append( remaining.ToString() );
includeStack.RemoveIndex(includeStack.Num() - 1);
return ret;
}