evaluate PlayerNumber as a lua expression
This commit is contained in:
@@ -359,6 +359,11 @@ float LuaManager::RunExpressionF( const CString &str )
|
||||
return result;
|
||||
}
|
||||
|
||||
int LuaManager::RunExpressionI( const CString &str )
|
||||
{
|
||||
return (int)RunExpressionF(str);
|
||||
}
|
||||
|
||||
bool LuaManager::RunExpressionS( const CString &str, CString &sOut )
|
||||
{
|
||||
if( !RunExpression( str ) )
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
/* Run an expression in the global environment, returning the given type. */
|
||||
bool RunExpressionB( const CString &str );
|
||||
float RunExpressionF( const CString &str );
|
||||
int RunExpressionI( const CString &str );
|
||||
bool RunExpressionS( const CString &str, CString &sOut );
|
||||
|
||||
/* If sStr begins with @, evaluate the rest as an expression and store the result over sStr. */
|
||||
|
||||
@@ -27,8 +27,12 @@ void ScoreDisplayCalories::LoadFromNode( const CString& sDir, const XNode* pNode
|
||||
{
|
||||
RollingNumbers::LoadFromNode( sDir, pNode );
|
||||
|
||||
bool b = pNode->GetAttrValue( "PlayerNumber", (int&)m_PlayerNumber );
|
||||
ASSERT( b );
|
||||
{
|
||||
CString sPlayerNumber;
|
||||
bool b = pNode->GetAttrValue( "PlayerNumber", sPlayerNumber );
|
||||
ASSERT( b );
|
||||
m_PlayerNumber = (PlayerNumber)LUA->RunExpressionI(sPlayerNumber);
|
||||
}
|
||||
|
||||
m_sMessageOnStep = ssprintf("StepP%d",m_PlayerNumber+1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user