The distinction between a random course entry and a nonfixed one is not clear. A newly created course entry would have IsRandomSong() return false yet when placed in a course, the course would return AllSongsFixed() as false. Redefine a random song to be pSong = NULL.

Remove the sentinel value since the songs are already shuffled. Picking the first one is enough.
This commit is contained in:
Steve Checkoway
2006-02-21 02:29:22 +00:00
parent 9c1cba73f5
commit cc7a528269
2 changed files with 4 additions and 11 deletions
+3 -5
View File
@@ -513,10 +513,8 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
CourseSortSongs( e->songSort, vpPossibleSongs, rnd );
ASSERT( e->iChooseIndex >= -1 );
if( e->iChooseIndex == -1 )
pResolvedSong = vpPossibleSongs[RandomInt(0, vpPossibleSongs.size()-1)];
else if( e->iChooseIndex < int(vpPossibleSongs.size()) )
ASSERT( e->iChooseIndex >= 0 );
if( e->iChooseIndex < int(vpPossibleSongs.size()) )
pResolvedSong = vpPossibleSongs[e->iChooseIndex];
else
continue;
@@ -674,7 +672,7 @@ bool Course::AllSongsAreFixed() const
{
FOREACH_CONST( CourseEntry, m_vEntries, e )
{
if( e->pSong == NULL )
if( !e->IsFixedSong() )
return false;
}
return true;