diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index eb17b8ceef..c798c0a6a1 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -78,25 +78,13 @@ ScreenSelectGroup::ScreenSelectGroup() aAllSongs.Copy( SONGMAN->m_pSongs ); // Filter out Songs that can't be played by the current Style - NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType; - - for( i=aAllSongs.GetSize()-1; i>=0; i-- ) // foreach Song, back to front { - Song* pSong = aAllSongs[i]; - - bool bSongCanBePlayedByCurrentStyle = false; - for( int j=0; jm_apNotes.GetSize(); j++ ) // foreach Notes + NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType; + for( i=aAllSongs.GetSize()-1; i>=0; i-- ) // foreach Song, back to front { - Notes* pNotes = pSong->m_apNotes[j]; - - if( pNotes->m_NotesType == nt ) - { - bSongCanBePlayedByCurrentStyle = true; - break; - } + if( !aAllSongs[i]->SongHasNoteType(nt) ) + aAllSongs.RemoveAt( i ); } - if( !bSongCanBePlayedByCurrentStyle ) - aAllSongs.RemoveAt( i ); } // Get group names by thowing them into a hash diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 968e519a8e..cb93f1ab38 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -1212,6 +1212,17 @@ void Song::GetNotesThatMatch( NotesType nt, CArray& arrayAddTo ) arrayAddTo.Add( m_apNotes[i] ); } +bool Song::SongHasNoteType( NotesType nt ) const +{ + for( int i=0; i < m_apNotes.GetSize(); i++ ) // foreach Notes + { + if( m_apNotes[i]->m_NotesType == nt ) + return true; + } + + return false; +} + void Song::SaveToCacheFile() { LOG->Trace( "Song::SaveToCacheFile()" ); diff --git a/stepmania/src/song.h b/stepmania/src/song.h index ec96f51e88..1de0095f8a 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -156,6 +156,7 @@ public: CArray m_apNotes; + bool SongHasNoteType( NotesType nt ) const; void GetNotesThatMatch( NotesType nt, CArray& arrayAddTo ); int GetNumTimesPlayed() {