本文整理汇总了C++中CTokenizer::GetInt方法的典型用法代码示例。如果您正苦于以下问题:C++ CTokenizer::GetInt方法的具体用法?C++ CTokenizer::GetInt怎么用?C++ CTokenizer::GetInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTokenizer
的用法示例。
在下文中一共展示了CTokenizer::GetInt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseStateDef
//.........这里部分代码省略.........
case 'C':
StateManager.SetStatePhysicType(crouch);
break;
case 'A':
StateManager.SetStatePhysicType(air);
break;
case 'N':
StateManager.SetStatePhysicType(none);
break;
case 'U':
StateManager.SetStatePhysicType(untouch);
break;
default:
Error("Unknown physic type",tok);
break;
}
} else if( tok.CheckToken("anim") )
{
if( !tok.CheckToken("=") )
Error("expected =",tok);
if(!tok.CheckTokenIsNumber())
Error("Expected a number for anim",tok);
StateManager.SetStateAnim(tok.GetInt());
} else if( tok.CheckToken("velset") )
{
if( !tok.CheckToken("=") )
Error("expected =",tok);
float x=tok.GetFloat();
if( !tok.CheckToken(",") )
Error("expected ,",tok);
float y=tok.GetFloat();
StateManager.SetVelSet(x,y);
} else if( tok.CheckToken("ctrl") )
{
if( !tok.CheckToken("=") )
Error("expected =",tok);
if(!tok.CheckTokenIsNumber())
Error("Expected a number for ctrl",tok);
StateManager.SetStateCtrl(tok.GetInt());
} else if( tok.CheckToken("poweradd") )
{
if( !tok.CheckToken("=") )
Error("expected =",tok);
if(!tok.CheckTokenIsNumber())
示例2: ParseVarSet
void CStateParser::ParseVarSet( CTokenizer &tok, CStateManager &StateManager )
{
VARSET *temp=(VARSET*) m_pAlloc->Alloc(sizeof(VARSET));
//TODO:Check for Required parameters and print error msg
while( !tok.CheckToken("[", false) && !tok.AtEndOfFile() )
{
StateManager.NewInst();
if( tok.CheckToken("sysvar") )
{
if( !tok.CheckToken("(") )
Error("expected (",tok);
int value = tok.GetInt();
StateManager.AddInstruction(OP_PUSH, value, "#");
if( !tok.CheckToken(")") )
Error("expected )",tok);
if( !tok.CheckToken("=") )
Error("expected =",tok);
EvaluateExpression(tok,StateManager);
temp->common.sysvar = StateManager.GetParamIns();
}else if( tok.CheckToken("sysfvar") )
{
if( !tok.CheckToken("(") )
Error("expected (",tok);
int value = tok.GetInt();
StateManager.AddInstruction(OP_PUSH, value, "#");
if( !tok.CheckToken(")") )
Error("expected )",tok);
if( !tok.CheckToken("=") )
Error("expected =",tok);
EvaluateExpression(tok,StateManager);
temp->common.sysfvar = StateManager.GetParamIns();
}else if ( tok.CheckToken("var") )
{
if( !tok.CheckToken("(") )
Error("expected (",tok);
int value = tok.GetInt();
StateManager.AddInstruction(OP_PUSH, value, "#");
if( !tok.CheckToken(")") )
Error("expected )",tok);
if( !tok.CheckToken("=") )
Error("expected =",tok);
EvaluateExpression(tok,StateManager);
temp->common.var = StateManager.GetParamIns();
}else if ( tok.CheckToken("fvar") )
{
if( !tok.CheckToken("(") )
Error("expected (",tok);
int value = tok.GetInt();
StateManager.AddInstruction(OP_PUSH, value, "#");
if( !tok.CheckToken(")") )
Error("expected )",tok);
if( !tok.CheckToken("=") )
Error("expected =",tok);
EvaluateExpression(tok,StateManager);
temp->common.fvar = StateManager.GetParamIns();
}
}
StateManager.SetController(temp);
StateManager.NewInst();
}
示例3: ParseStateFile
void CStateParser::ParseStateFile(const char* strFileName,CStateManager &StateManager,CAllocater *a)
{
//Set pointer to allocater
m_pAlloc=a;
CTokenizer tok;
bool foundState=false;
if( !tok.OpenFile(strFileName) )
throw(CError("CStateParser::ParseState: File %s not found",strFileName));
tok.SetIsCaseSensitive(false);
tok.SetReturnNegativeSeperatelyFromNumber(false);
while( !tok.AtEndOfFile() )
{
foundState=false;
if( tok.CheckToken("[") )
{
if( tok.CheckToken("statedef") )
{
foundState=true;
if(!tok.CheckTokenIsNumber())
Error("Expected a number in statedef block",tok);
StateManager.AddStateDef(tok.GetInt());
//Skip useless stuff
while( !tok.AtEndOfLine() )
tok.GetToken();
//parse the state def
ParseStateDef(tok,StateManager);
}
if( tok.CheckToken("state") )
{
foundState=true;
if(!tok.CheckTokenIsNumber())
Error("Expected a number in state block",tok);
int stateno = tok.GetInt();
tok.CheckToken(",");
// if(!tok.CheckTokenIsQuotedString()
// && !tok.CheckTokenIsNumber())
// Error("Expected a number in state block",tok);
std::string str = tok.GetToken();
StateManager.AddState(stateno, str.c_str());
while(!tok.AtEndOfLine())
tok.GetToken();
PareseState(tok,StateManager);
}
}
//skip useless stuff
if(!foundState)
tok.GetToken();
}
tok.CloseFile();
}
示例4: LoadCMDFile
bool CCmdManager::LoadCMDFile( const char* file )
{
int defaultCommandTime = 15;
int defaultBufferTime = 1;
m_CommandCount = 0;
CTokenizer tok;
//changed this to throw a exception
if( !tok.OpenFile( file ) )
{
throw(CError("CCmdManager::LoadCMDFile : Can't open %s",file));
return false;
}
// get count first to set up memory
while( !tok.AtEndOfFile() )
{
bool foundSomething = false;
if( tok.CheckToken( "command.time" ) )
{
foundSomething = true;
if( !tok.CheckToken( "=" ) )
{
}
if( tok.CheckTokenIsNumber() )
{
defaultCommandTime = tok.GetInt();
}
}
if( tok.CheckToken( "command.buffer.time" ) )
{
foundSomething = true;
if( !tok.CheckToken( "=" ) )
{
}
if( tok.CheckTokenIsNumber() )
{
defaultBufferTime = tok.GetInt();
}
}
if( tok.CheckToken( "[" ) )
{
foundSomething = true;
if( tok.CheckToken( "Command" ) )
{
if( tok.CheckToken( "]" ) )
{
m_CommandCount++;
}
}
}
if( !foundSomething )
{
tok.GetToken(); // skip it
}
}
tok.CloseFile();
if( !tok.OpenFile( file ) )
return false;
m_Commands = new PLCOMMAND[ m_CommandCount ];
PLCOMMAND* command = m_Commands;
while( !tok.AtEndOfFile() )
{
bool foundCommand = false;
if( tok.CheckToken( "[" ) )
{
if( tok.CheckToken( "Command" ) )
{
if( !tok.CheckToken( "]" ) )
{
}
foundCommand = true;
command->nCommandTime = defaultCommandTime;
command->nBufferTime = defaultBufferTime;
command->strCommand[0] = 0;
command->nHowManyCommand = 0;
while( command->nHowManyCommand < MAXCOMMAND && !tok.CheckToken( "[", false ) && !tok.AtEndOfFile() )
{
if( tok.CheckToken( "name" ) )
{
if( !tok.CheckToken( "=" ) )
{
}
strcpy( command->strCommand, tok.GetToken() );
}
else if( tok.CheckToken( "command" ) )
{
if( !tok.CheckToken( "=" ) )
{
}
//.........这里部分代码省略.........