PercentageDisplay usage update

This commit is contained in:
Glenn Maynard
2007-03-02 04:53:06 +00:00
parent 2da0ef9a0a
commit 07ed0ee670
+14 -8
View File
@@ -23,18 +23,25 @@ PercentageDisplay::PercentageDisplay()
m_Last = -1; m_Last = -1;
m_LastMax = -1; m_LastMax = -1;
m_iDancePointsDigits = 0; m_iDancePointsDigits = 0;
m_bUseRemainder = false;
m_bApplyScoreDisplayOptions = false;
m_bAutoRefresh = false;
m_Format.SetFromExpression( "FormatPercentScore" ); m_Format.SetFromExpression( "FormatPercentScore" );
} }
void PercentageDisplay::LoadFromNode( const XNode* pNode ) void PercentageDisplay::LoadFromNode( const XNode* pNode )
{ {
pNode->GetAttrValue( "DancePointsDigits", m_iDancePointsDigits ); pNode->GetAttrValue( "DancePointsDigits", m_iDancePointsDigits );
pNode->GetAttrValue( "PercentUseRemainder", m_bUseRemainder );
pNode->GetAttrValue( "ApplyScoreDisplayOptions", m_bApplyScoreDisplayOptions ); pNode->GetAttrValue( "ApplyScoreDisplayOptions", m_bApplyScoreDisplayOptions );
pNode->GetAttrValue( "AutoRefresh", m_bAutoRefresh ); pNode->GetAttrValue( "AutoRefresh", m_bAutoRefresh );
RString sStr = "FormatPercentScore"; {
pNode->GetAttrValue( "Format", sStr ); Lua *L = LUA->Get();
m_Format.SetFromExpression( sStr ); if( pNode->PushAttrValue(L, "Format") )
m_Format.SetFromStack( L );
else
lua_pop(L, 1);
LUA->Release(L);
}
const XNode *pChild = pNode->GetChild( "Percent" ); const XNode *pChild = pNode->GetChild( "Percent" );
if( pChild == NULL ) if( pChild == NULL )
@@ -42,11 +49,10 @@ void PercentageDisplay::LoadFromNode( const XNode* pNode )
m_textPercent.LoadFromNode( pChild ); m_textPercent.LoadFromNode( pChild );
this->AddChild( &m_textPercent ); this->AddChild( &m_textPercent );
if( !PREFSMAN->m_bDancePointsForOni && m_bUseRemainder ) pChild = pNode->GetChild( "PercentRemainder" );
if( !PREFSMAN->m_bDancePointsForOni && pChild != NULL )
{ {
const XNode *pChild = pNode->GetChild( "PercentRemainder" ); m_bUseRemainder = true;
if( pChild == NULL )
RageException::Throw( "%s: ComboGraph: missing the node \"PercentRemainder\"", ActorUtil::GetWhere(pNode).c_str() );
m_textPercentRemainder.LoadFromNode( pChild ); m_textPercentRemainder.LoadFromNode( pChild );
this->AddChild( &m_textPercentRemainder ); this->AddChild( &m_textPercentRemainder );
} }