Add Song::SongHasNoteType, moved from ScreenSelectGroup.

This commit is contained in:
Glenn Maynard
2002-08-20 06:47:30 +00:00
parent 2d39de68e9
commit 2e78a4d08f
3 changed files with 16 additions and 16 deletions
+4 -16
View File
@@ -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; j<pSong->m_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
+11
View File
@@ -1212,6 +1212,17 @@ void Song::GetNotesThatMatch( NotesType nt, CArray<Notes*, Notes*>& 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()" );
+1
View File
@@ -156,6 +156,7 @@ public:
CArray<Notes*, Notes*> m_apNotes;
bool SongHasNoteType( NotesType nt ) const;
void GetNotesThatMatch( NotesType nt, CArray<Notes*, Notes*>& arrayAddTo );
int GetNumTimesPlayed()
{