Lineage reporting for nil commands in RunCommands. Stricter type checking for FormatPercentScore in PercentageDisplay.
This commit is contained in:
@@ -706,7 +706,7 @@ PercentUseRemainder=false
|
|||||||
ApplyScoreDisplayOptions=true
|
ApplyScoreDisplayOptions=true
|
||||||
DancePointsDigits=5
|
DancePointsDigits=5
|
||||||
#
|
#
|
||||||
Format="%2d"
|
Format=FormatPercentScore
|
||||||
#
|
#
|
||||||
RemainderFormat=
|
RemainderFormat=
|
||||||
#
|
#
|
||||||
@@ -1399,7 +1399,7 @@ DancePointsDigits=1
|
|||||||
PercentUseRemainder=true
|
PercentUseRemainder=true
|
||||||
ApplyScoreDisplayOptions=false
|
ApplyScoreDisplayOptions=false
|
||||||
FormatPercentScore=FormatPercentScore
|
FormatPercentScore=FormatPercentScore
|
||||||
Format=
|
Format=FormatPercentScore
|
||||||
|
|
||||||
[SoundEffectControl]
|
[SoundEffectControl]
|
||||||
LockToHold=false
|
LockToHold=false
|
||||||
|
|||||||
@@ -140,8 +140,6 @@ NumLivesP2OnCommand=zoomx,-1
|
|||||||
NumLivesP2LoseLifeCommand=zoomx,-1.5;zoomy,1.5;linear,0.15;zoomx,-1;zoomy,1
|
NumLivesP2LoseLifeCommand=zoomx,-1.5;zoomy,1.5;linear,0.15;zoomx,-1;zoomy,1
|
||||||
|
|
||||||
[LifeMeterBattery Percent]
|
[LifeMeterBattery Percent]
|
||||||
# still asking for this even though it's in fallback... -aj
|
|
||||||
Format=
|
|
||||||
#
|
#
|
||||||
PercentP2OnCommand=zoom,0.7;zoomx,-0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2)
|
PercentP2OnCommand=zoom,0.7;zoomx,-0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2)
|
||||||
DancePointsP2OnCommand=zoom,0.7;zoomx,-0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2)
|
DancePointsP2OnCommand=zoom,0.7;zoomx,-0.7;shadowlength,0;diffuse,PlayerColor(PLAYER_2)
|
||||||
|
|||||||
+4
-4
@@ -785,7 +785,7 @@ RString Actor::GetLineage() const
|
|||||||
|
|
||||||
if( m_pParent )
|
if( m_pParent )
|
||||||
sPath = m_pParent->GetLineage() + '/';
|
sPath = m_pParent->GetLineage() + '/';
|
||||||
sPath += ssprintf( "<%s> %s", typeid(*this).name(), m_sName.c_str() );
|
sPath += ssprintf( "<type %s> %s", typeid(*this).name(), m_sName.c_str() );
|
||||||
return sPath;
|
return sPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1130,7 +1130,7 @@ void Actor::RunCommands( const LuaReference& cmds, const LuaReference *pParamTab
|
|||||||
{
|
{
|
||||||
if( !cmds.IsSet() || cmds.IsNil() )
|
if( !cmds.IsSet() || cmds.IsNil() )
|
||||||
{
|
{
|
||||||
LuaHelpers::ReportScriptError("RunCommands: command is unset or nil");
|
LuaHelpers::ReportScriptErrorFmt("RunCommands: commands for %s are unset or nil", GetLineage().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1140,7 +1140,7 @@ void Actor::RunCommands( const LuaReference& cmds, const LuaReference *pParamTab
|
|||||||
cmds.PushSelf( L );
|
cmds.PushSelf( L );
|
||||||
if( lua_isnil(L, -1) )
|
if( lua_isnil(L, -1) )
|
||||||
{
|
{
|
||||||
LuaHelpers::ReportScriptError("Error compiling commands");
|
LuaHelpers::ReportScriptErrorFmt("RunCommands: Error compiling commands for %s", GetLineage().c_str());
|
||||||
LUA->Release(L);
|
LUA->Release(L);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1155,7 +1155,7 @@ void Actor::RunCommands( const LuaReference& cmds, const LuaReference *pParamTab
|
|||||||
pParamTable->PushSelf( L );
|
pParamTable->PushSelf( L );
|
||||||
|
|
||||||
// call function with 2 arguments and 0 results
|
// call function with 2 arguments and 0 results
|
||||||
RString Error= "Error playing command: ";
|
RString Error= "Error playing command:";
|
||||||
LuaHelpers::RunScriptOnStack(L, Error, 2, 0, true);
|
LuaHelpers::RunScriptOnStack(L, Error, 2, 0, true);
|
||||||
|
|
||||||
LUA->Release(L);
|
LUA->Release(L);
|
||||||
|
|||||||
+28
-11
@@ -33,10 +33,22 @@ void PercentageDisplay::LoadFromNode( const XNode* pNode )
|
|||||||
pNode->GetAttrValue( "AutoRefresh", m_bAutoRefresh );
|
pNode->GetAttrValue( "AutoRefresh", m_bAutoRefresh );
|
||||||
{
|
{
|
||||||
Lua *L = LUA->Get();
|
Lua *L = LUA->Get();
|
||||||
if( pNode->PushAttrValue(L, "FormatPercentScore") )
|
if(pNode->PushAttrValue(L, "FormatPercentScore"))
|
||||||
|
{
|
||||||
m_FormatPercentScore.SetFromStack( L );
|
m_FormatPercentScore.SetFromStack( L );
|
||||||
|
if(m_FormatPercentScore.GetLuaType() != LUA_TFUNCTION)
|
||||||
|
{
|
||||||
|
// Not reported as an error because _fallback and default provided bad
|
||||||
|
// examples in their [LifeMeterBattery Percent]:Format metric and nobody
|
||||||
|
// realized it was supposed to be set to a function. -Kyz
|
||||||
|
LOG->Trace("Format attribute for PercentageDisplay named '%s' is not a function. Defaulting to 'FormatPercentScore'.", GetName().c_str());
|
||||||
|
m_FormatPercentScore.SetFromExpression("FormatPercentScore");
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
}
|
||||||
LUA->Release(L);
|
LUA->Release(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,9 +98,12 @@ void PercentageDisplay::Load( const PlayerState *pPlayerState, const PlayerStage
|
|||||||
m_sPercentFormat = THEME->GetMetric( sMetricsGroup, "PercentFormat" );
|
m_sPercentFormat = THEME->GetMetric( sMetricsGroup, "PercentFormat" );
|
||||||
m_sRemainderFormat = THEME->GetMetric( sMetricsGroup, "RemainderFormat" );
|
m_sRemainderFormat = THEME->GetMetric( sMetricsGroup, "RemainderFormat" );
|
||||||
|
|
||||||
if( m_FormatPercentScore.IsNil() )
|
if(m_FormatPercentScore.GetLuaType() != LUA_TFUNCTION)
|
||||||
{
|
{
|
||||||
LOG->Trace( "Format is nil in [%s]. Defaulting to 'FormatPercentScore'.", sMetricsGroup.c_str() );
|
// Not reported as an error because _fallback and default provided bad
|
||||||
|
// examples in their [LifeMeterBattery Percent]:Format metric and nobody
|
||||||
|
// realized it was supposed to be set to a function. -Kyz
|
||||||
|
LOG->Trace("Format metric is not a function in [%s]. Defaulting to 'FormatPercentScore'.", sMetricsGroup.c_str());
|
||||||
m_FormatPercentScore.SetFromExpression( "FormatPercentScore" );
|
m_FormatPercentScore.SetFromExpression( "FormatPercentScore" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,14 +172,16 @@ void PercentageDisplay::Refresh()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Lua *L = LUA->Get();
|
if(m_FormatPercentScore.GetLuaType() == LUA_TFUNCTION)
|
||||||
m_FormatPercentScore.PushSelf( L );
|
{
|
||||||
ASSERT( !lua_isnil(L, -1) );
|
Lua *L = LUA->Get();
|
||||||
LuaHelpers::Push( L, fPercentDancePoints );
|
m_FormatPercentScore.PushSelf( L );
|
||||||
RString Error= "Error running FormatPercentScore: ";
|
LuaHelpers::Push( L, fPercentDancePoints );
|
||||||
LuaHelpers::RunScriptOnStack(L, Error, 1, 1, true); // 1 arg, 1 result
|
RString Error= "Error running FormatPercentScore: ";
|
||||||
LuaHelpers::Pop( L, sNumToDisplay );
|
LuaHelpers::RunScriptOnStack(L, Error, 1, 1, true); // 1 arg, 1 result
|
||||||
LUA->Release(L);
|
LuaHelpers::Pop( L, sNumToDisplay );
|
||||||
|
LUA->Release(L);
|
||||||
|
}
|
||||||
|
|
||||||
// HACK: Use the last frame in the numbers texture as '-'
|
// HACK: Use the last frame in the numbers texture as '-'
|
||||||
sNumToDisplay.Replace('-','x');
|
sNumToDisplay.Replace('-','x');
|
||||||
|
|||||||
Reference in New Issue
Block a user