本文整理汇总了C++中idLexer::LoadFile方法的典型用法代码示例。如果您正苦于以下问题:C++ idLexer::LoadFile方法的具体用法?C++ idLexer::LoadFile怎么用?C++ idLexer::LoadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idLexer
的用法示例。
在下文中一共展示了idLexer::LoadFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareGameState
/*
================
idTypeInfoTools::CompareGameState
================
*/
void idTypeInfoTools::CompareGameState( const char *fileName ) {
int entityNum;
idToken token;
src = new idLexer();
src->SetFlags( LEXFL_NOSTRINGESCAPECHARS );
if ( !src->LoadFile( fileName ) ) {
common->Warning( "couldn't load %s", fileName );
delete src;
src = NULL;
return;
}
fp = NULL;
Write = VerifyVariable;
#ifdef DUMP_GAMELOCAL
if ( !src->ExpectTokenString( "gameLocal" ) || !src->ExpectTokenString( "{" ) ) {
delete src;
src = NULL;
return;
}
WriteClass_r( (void *)&gameLocal, "", "idGameLocal", "idGameLocal", "", 0 );
if ( !src->ExpectTokenString( "}" ) ) {
delete src;
src = NULL;
return;
}
#endif
while( src->ReadToken( &token ) ) {
if ( token != "entity" ) {
break;
}
if ( !src->ExpectTokenType( TT_NUMBER, TT_INTEGER, &token ) ) {
break;
}
entityNum = token.GetIntValue();
if ( entityNum < 0 || entityNum >= gameLocal.num_entities ) {
src->Warning( "entity number %d out of range", entityNum );
break;
}
typeError = false;
idEntity *ent = gameLocal.entities[entityNum];
if ( !ent ) {
src->Warning( "entity %d is not spawned", entityNum );
src->SkipBracedSection( true );
continue;
}
if ( !src->ExpectTokenType( TT_NAME, 0, &token ) ) {
break;
}
if ( token.Cmp( ent->GetType()->classname ) != 0 ) {
src->Warning( "entity %d has wrong type", entityNum );
src->SkipBracedSection( true );
continue;
}
if ( !src->ExpectTokenString( "{" ) ) {
src->Warning( "entity %d missing leading {", entityNum );
break;
}
WriteClass_r( (void *)ent, "", ent->GetType()->classname, ent->GetType()->classname, "", 0 );
if ( !src->SkipBracedSection( false ) ) {
src->Warning( "entity %d missing trailing }", entityNum );
break;
}
}
delete src;
src = NULL;
}