fix DifficultyList colors not updated when selecting Random
This commit is contained in:
@@ -135,7 +135,7 @@ void DifficultyMeter::SetFromGameState( PlayerNumber pn )
|
|||||||
if( pTrail )
|
if( pTrail )
|
||||||
SetFromTrail( pTrail );
|
SetFromTrail( pTrail );
|
||||||
else
|
else
|
||||||
SetFromCourseDifficulty( GAMESTATE->m_PreferredCourseDifficulty[pn] );
|
SetFromMeterAndCourseDifficulty( 0, GAMESTATE->m_PreferredCourseDifficulty[pn] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -143,7 +143,7 @@ void DifficultyMeter::SetFromGameState( PlayerNumber pn )
|
|||||||
if( pSteps )
|
if( pSteps )
|
||||||
SetFromSteps( pSteps );
|
SetFromSteps( pSteps );
|
||||||
else
|
else
|
||||||
SetFromDifficulty( GAMESTATE->m_PreferredDifficulty[pn] );
|
SetFromMeterAndDifficulty( 0, GAMESTATE->m_PreferredDifficulty[pn] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,20 +156,7 @@ void DifficultyMeter::SetFromSteps( const Steps* pSteps )
|
|||||||
}
|
}
|
||||||
|
|
||||||
Difficulty dc = pSteps->GetDifficulty();
|
Difficulty dc = pSteps->GetDifficulty();
|
||||||
SetFromMeterAndDifficulty( pSteps->GetMeter(), dc );
|
SetInternal( pSteps->GetMeter(), dc, GetDifficultyCommandName(dc), dc == DIFFICULTY_EDIT ? pSteps->GetDescription() : CString() );
|
||||||
PlayDifficultyCommand( GetDifficultyCommandName( dc ) );
|
|
||||||
if( m_bShowEditDescription )
|
|
||||||
{
|
|
||||||
if( dc == DIFFICULTY_EDIT )
|
|
||||||
{
|
|
||||||
m_textEditDescription.SetVisible( true );
|
|
||||||
m_textEditDescription.SetText( pSteps->GetDescription() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_textEditDescription.SetVisible( false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DifficultyMeter::SetFromTrail( const Trail* pTrail )
|
void DifficultyMeter::SetFromTrail( const Trail* pTrail )
|
||||||
@@ -181,33 +168,25 @@ void DifficultyMeter::SetFromTrail( const Trail* pTrail )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CourseDifficulty cd = pTrail->m_CourseDifficulty;
|
CourseDifficulty cd = pTrail->m_CourseDifficulty;
|
||||||
SetFromMeterAndDifficulty( pTrail->GetMeter(), cd );
|
SetInternal( pTrail->GetMeter(), cd, GetCourseDifficultyCommandName( cd ), CString() );
|
||||||
PlayDifficultyCommand( GetCourseDifficultyCommandName( cd ) );
|
|
||||||
if( m_bShowEditDescription )
|
|
||||||
m_textEditDescription.SetVisible( false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DifficultyMeter::Unset()
|
void DifficultyMeter::Unset()
|
||||||
{
|
{
|
||||||
SetFromMeterAndDifficulty( 0, DIFFICULTY_BEGINNER );
|
SetInternal( 0, DIFFICULTY_BEGINNER, DIFFICULTY_COMMAND_NAME_NONE, CString() );
|
||||||
PlayDifficultyCommand( DIFFICULTY_COMMAND_NAME_NONE );
|
|
||||||
if( m_bShowEditDescription )
|
|
||||||
m_textEditDescription.SetText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
void DifficultyMeter::SetFromDifficulty( Difficulty dc )
|
|
||||||
{
|
|
||||||
SetFromMeterAndDifficulty( 0, DIFFICULTY_BEGINNER );
|
|
||||||
PlayDifficultyCommand( GetDifficultyCommandName( dc ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void DifficultyMeter::SetFromCourseDifficulty( CourseDifficulty cd )
|
|
||||||
{
|
|
||||||
SetFromMeterAndDifficulty( 0, DIFFICULTY_BEGINNER );
|
|
||||||
PlayDifficultyCommand( GetCourseDifficultyCommandName( cd ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DifficultyMeter::SetFromMeterAndDifficulty( int iMeter, Difficulty dc )
|
void DifficultyMeter::SetFromMeterAndDifficulty( int iMeter, Difficulty dc )
|
||||||
|
{
|
||||||
|
SetInternal( 0, DIFFICULTY_BEGINNER, GetDifficultyCommandName(dc), CString() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void DifficultyMeter::SetFromMeterAndCourseDifficulty( int iMeter, CourseDifficulty cd )
|
||||||
|
{
|
||||||
|
SetInternal( 0, DIFFICULTY_BEGINNER, GetCourseDifficultyCommandName(cd), CString() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void DifficultyMeter::SetInternal( int iMeter, Difficulty dc, const CString &sDifficultyCommand, const CString &sDescription )
|
||||||
{
|
{
|
||||||
if( m_bShowFeet )
|
if( m_bShowFeet )
|
||||||
{
|
{
|
||||||
@@ -242,10 +221,20 @@ void DifficultyMeter::SetFromMeterAndDifficulty( int iMeter, Difficulty dc )
|
|||||||
m_textMeter.SetText( sMeter );
|
m_textMeter.SetText( sMeter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_bShowEditDescription )
|
||||||
|
{
|
||||||
|
if( dc == DIFFICULTY_EDIT )
|
||||||
|
{
|
||||||
|
m_textEditDescription.SetVisible( true );
|
||||||
|
m_textEditDescription.SetText( sDescription );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_textEditDescription.SetVisible( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DifficultyMeter::PlayDifficultyCommand( CString sDifficultyCommand )
|
|
||||||
{
|
|
||||||
if( m_sCurDifficultyCommand == sDifficultyCommand )
|
if( m_sCurDifficultyCommand == sDifficultyCommand )
|
||||||
return;
|
return;
|
||||||
m_sCurDifficultyCommand = sDifficultyCommand;
|
m_sCurDifficultyCommand = sDifficultyCommand;
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public:
|
|||||||
|
|
||||||
void SetFromGameState( PlayerNumber pn );
|
void SetFromGameState( PlayerNumber pn );
|
||||||
void SetFromMeterAndDifficulty( int iMeter, Difficulty dc );
|
void SetFromMeterAndDifficulty( int iMeter, Difficulty dc );
|
||||||
|
void SetFromMeterAndCourseDifficulty( int iMeter, CourseDifficulty cd );
|
||||||
void SetFromSteps( const Steps* pSteps );
|
void SetFromSteps( const Steps* pSteps );
|
||||||
void SetFromTrail( const Trail* pTrail );
|
void SetFromTrail( const Trail* pTrail );
|
||||||
void Unset();
|
void Unset();
|
||||||
@@ -65,10 +66,7 @@ public:
|
|||||||
void PushSelf( lua_State *L );
|
void PushSelf( lua_State *L );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetFromDifficulty( Difficulty dc );
|
void SetInternal( int iMeter, Difficulty dc, const CString &sDifficultyCommand, const CString &sDescription );
|
||||||
void SetFromCourseDifficulty( CourseDifficulty cd );
|
|
||||||
|
|
||||||
void PlayDifficultyCommand( CString diff );
|
|
||||||
|
|
||||||
BitmapText m_textFeet; // bar
|
BitmapText m_textFeet; // bar
|
||||||
CString m_sCurDifficultyCommand;
|
CString m_sCurDifficultyCommand;
|
||||||
|
|||||||
Reference in New Issue
Block a user