fix difficulties jump around when switching StepsType

This commit is contained in:
Chris Danford
2006-03-27 07:51:52 +00:00
parent 52ec9b3737
commit bde1988a30
2 changed files with 72 additions and 54 deletions
+71 -53
View File
@@ -381,68 +381,86 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
case ROW_STEPS_TYPE: case ROW_STEPS_TYPE:
m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToLocalizedString(GetSelectedStepsType()) ); m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToLocalizedString(GetSelectedStepsType()) );
m_vpSteps.clear();
FOREACH_Difficulty( dc )
{ {
if( dc == DIFFICULTY_EDIT ) Difficulty dcOld = DIFFICULTY_INVALID;
if( !m_vpSteps.empty() )
{ {
switch( EDIT_MODE.GetValue() ) Steps *pSteps = GetSelectedSteps();
{ dcOld = pSteps->GetDifficulty();
case EditMode_Full: }
case EditMode_CourseMods:
case EditMode_Practice:
{
vector<Steps*> v;
GetSelectedSong()->GetSteps( v, GetSelectedStepsType(), DIFFICULTY_EDIT );
StepsUtil::SortStepsByDescription( v );
FOREACH_CONST( Steps*, v, p )
m_vpSteps.push_back( StepsAndDifficulty(*p,dc) );
}
break;
case EditMode_Home:
// have only "New Edit"
break;
default:
ASSERT(0);
}
switch( EDIT_MODE.GetValue() ) m_vpSteps.clear();
FOREACH_Difficulty( dc )
{
if( dc == DIFFICULTY_EDIT )
{ {
case EditMode_Practice: switch( EDIT_MODE.GetValue() )
case EditMode_CourseMods: {
break; case EditMode_Full:
case EditMode_Home: case EditMode_CourseMods:
case EditMode_Full: case EditMode_Practice:
m_vpSteps.push_back( StepsAndDifficulty(NULL,dc) ); // "New Edit" {
break; vector<Steps*> v;
default: GetSelectedSong()->GetSteps( v, GetSelectedStepsType(), DIFFICULTY_EDIT );
ASSERT(0); StepsUtil::SortStepsByDescription( v );
FOREACH_CONST( Steps*, v, p )
m_vpSteps.push_back( StepsAndDifficulty(*p,dc) );
}
break;
case EditMode_Home:
// have only "New Edit"
break;
default:
ASSERT(0);
}
switch( EDIT_MODE.GetValue() )
{
case EditMode_Practice:
case EditMode_CourseMods:
break;
case EditMode_Home:
case EditMode_Full:
m_vpSteps.push_back( StepsAndDifficulty(NULL,dc) ); // "New Edit"
break;
default:
ASSERT(0);
}
}
else
{
Steps *pSteps = GetSelectedSong()->GetStepsByDifficulty( GetSelectedStepsType(), dc );
if( pSteps && UNLOCKMAN->StepsIsLocked( GetSelectedSong(), pSteps ) )
pSteps = NULL;
switch( EDIT_MODE.GetValue() )
{
case EditMode_Home:
// don't allow selecting of non-edits in HomeMode
break;
case EditMode_Practice:
case EditMode_CourseMods:
// only show this difficulty if steps exist
if( pSteps )
m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) );
break;
case EditMode_Full:
// show this difficulty whether or not steps exist.
m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) );
break;
default:
ASSERT(0);
}
} }
} }
else
{
Steps *pSteps = GetSelectedSong()->GetStepsByDifficulty( GetSelectedStepsType(), dc );
if( pSteps && UNLOCKMAN->StepsIsLocked( GetSelectedSong(), pSteps ) )
pSteps = NULL;
switch( EDIT_MODE.GetValue() ) FOREACH( StepsAndDifficulty, m_vpSteps, s )
{
if( s->pSteps->GetDifficulty() == dcOld )
{ {
case EditMode_Home: m_iSelection[ROW_STEPS] = s - m_vpSteps.begin();
// don't allow selecting of non-edits in HomeMode
break; break;
case EditMode_Practice:
case EditMode_CourseMods:
// only show this difficulty if steps exist
if( pSteps )
m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) );
break;
case EditMode_Full:
// show this difficulty whether or not steps exist.
m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) );
break;
default:
ASSERT(0);
} }
} }
} }
+1 -1
View File
@@ -71,7 +71,7 @@ public:
StepsType GetSelectedSourceStepsType() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS_TYPE] < (int)m_StepsTypes.size()); return m_StepsTypes[m_iSelection[ROW_SOURCE_STEPS_TYPE]]; } StepsType GetSelectedSourceStepsType() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS_TYPE] < (int)m_StepsTypes.size()); return m_StepsTypes[m_iSelection[ROW_SOURCE_STEPS_TYPE]]; }
Steps* GetSelectedSourceSteps() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS] < (int)m_vpSourceSteps.size()); return m_vpSourceSteps[m_iSelection[ROW_SOURCE_STEPS]].pSteps; } Steps* GetSelectedSourceSteps() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS] < (int)m_vpSourceSteps.size()); return m_vpSourceSteps[m_iSelection[ROW_SOURCE_STEPS]].pSteps; }
Difficulty GetSelectedSourceDifficulty() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS] < (int)m_vpSourceSteps.size()); return m_vpSourceSteps[m_iSelection[ROW_SOURCE_STEPS]].dc; } Difficulty GetSelectedSourceDifficulty() const { ASSERT(m_iSelection[ROW_SOURCE_STEPS] < (int)m_vpSourceSteps.size()); return m_vpSourceSteps[m_iSelection[ROW_SOURCE_STEPS]].dc; }
EditMenuAction GetSelectedAction() const { ASSERT(m_iSelection[ROW_ACTION] < (int)m_Actions.size()); return m_Actions[m_iSelection[ROW_ACTION]]; } EditMenuAction GetSelectedAction() const { ASSERT(m_iSelection[ROW_ACTION] < (int)m_Actions.size()); return m_Actions[m_iSelection[ROW_ACTION]]; }
EditMenuRow GetSelectedRow() const { return m_SelectedRow; } EditMenuRow GetSelectedRow() const { return m_SelectedRow; }