From 7caf4adce7b59d2f2ab16d1912e4e4c4ec620b62 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 16 May 2006 01:47:09 +0000 Subject: [PATCH] hide locked steps --- stepmania/src/EditMenu.cpp | 14 +++++++++++++- stepmania/src/EditMenu.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/stepmania/src/EditMenu.cpp b/stepmania/src/EditMenu.cpp index bd2111aeae..ee9e516c44 100644 --- a/stepmania/src/EditMenu.cpp +++ b/stepmania/src/EditMenu.cpp @@ -42,6 +42,16 @@ static RString ROW_VALUE_X_NAME( size_t i ) { return ssprintf("RowValue%dX",int( static RString ROW_Y_NAME( size_t i ) { return ssprintf("Row%dY",int(i+1)); } +void EditMenu::StripLockedStepsAndDifficulty( vector &v ) +{ + const Song *pSong = GetSelectedSong(); + for( int i=(int)v.size(); i>=0; i-- ) + { + if( v[i].pSteps && UNLOCKMAN->StepsIsLocked(pSong, v[i].pSteps) ) + v.erase( v.begin()+i ); + } +} + void EditMenu::GetSongsToShowForGroup( const RString &sGroup, vector &vpSongsOut ) { vpSongsOut.clear(); @@ -451,6 +461,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row ) } } } + StripLockedStepsAndDifficulty( m_vpSteps ); FOREACH( StepsAndDifficulty, m_vpSteps, s ) { @@ -511,7 +522,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row ) m_vpSourceSteps.push_back( StepsAndDifficulty(NULL,DIFFICULTY_INVALID) ); // "blank" FOREACH_Difficulty( dc ) { - // fill in pSteps + // fill in m_vpSourceSteps if( dc != DIFFICULTY_EDIT ) { Steps *pSteps = GetSelectedSong()->GetStepsByDifficulty( GetSelectedSourceStepsType(), dc ); @@ -527,6 +538,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row ) m_vpSourceSteps.push_back( StepsAndDifficulty(*pSteps,dc) ); } } + StripLockedStepsAndDifficulty( m_vpSteps ); CLAMP( m_iSelection[ROW_SOURCE_STEPS], 0, m_vpSourceSteps.size()-1 ); // fall through case ROW_SOURCE_STEPS: diff --git a/stepmania/src/EditMenu.h b/stepmania/src/EditMenu.h index 288304832e..b7f2c3dd56 100644 --- a/stepmania/src/EditMenu.h +++ b/stepmania/src/EditMenu.h @@ -76,6 +76,9 @@ public: EditMenuRow GetSelectedRow() const { return m_SelectedRow; } private: + struct StepsAndDifficulty; + + void StripLockedStepsAndDifficulty( vector &v ); void GetSongsToShowForGroup( const RString &sGroup, vector &vpSongsOut ); void GetGroupsToShow( vector &vsGroupsOut );