Instead of choosing random songs in Endless, pre-shuffle them to

avoid repetition.
This commit is contained in:
Glenn Maynard
2002-09-04 03:29:42 +00:00
parent df7a03cd56
commit 1e6faf12a6
4 changed files with 32 additions and 14 deletions
+18 -4
View File
@@ -122,8 +122,15 @@ void Course::CreateEndlessCourseFromGroupAndDifficultyClass( CString sGroupName,
Song* pSong = apSongsInGroup[s];
AddStage( pSong, DifficultyClassToString(dc), "" );
}
Shuffle();
}
void Course::Shuffle()
{
/* Shuffle the list. */
for( int i = 0; i < m_iStages; ++i)
swap(SongOrdering[i], SongOrdering[rand() % m_iStages]);
}
Notes* Course::GetNotesForStage( int iStage )
{
@@ -154,13 +161,20 @@ Notes* Course::GetNotesForStage( int iStage )
}
void Course::GetSongAndNotesForCurrentStyle( CArray<Song*,Song*>& apSongsOut, CArray<Notes*,Notes*>& apNotesOut, CStringArray& asModifiersOut )
/* When bShuffled is true, returns courses in the song ordering list. */
void Course::GetSongAndNotesForCurrentStyle(
CArray<Song*,Song*>& apSongsOut,
CArray<Notes*,Notes*>& apNotesOut,
CStringArray& asModifiersOut,
bool bShuffled )
{
for( int i=0; i<m_iStages; i++ )
{
Song* pSong = m_apSongs[i];
Notes* pNotes = GetNotesForStage( i );
CString sModifiers = m_asModifiers[i];
int num = bShuffled? SongOrdering[i]:i;
Song* pSong = m_apSongs[num];
Notes* pNotes = GetNotesForStage( num );
CString sModifiers = m_asModifiers[num];
if( pNotes == NULL )
continue; // skip