From cc7a5282698825a26770396679a98b19ce9fa4d0 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Tue, 21 Feb 2006 02:29:22 +0000 Subject: [PATCH] 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. --- stepmania/src/Course.cpp | 8 +++----- stepmania/src/Course.h | 7 +------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 66ffcebccb..fd10b4e2b0 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -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; diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 6eae48c580..79420c3ebd 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -89,12 +89,7 @@ public: fGainSeconds = 0; } - bool IsRandomSong() const - { - return - iChooseIndex == -1 && - pSong == NULL; - } + bool IsFixedSong() const { return pSong != NULL; } RString GetTextDescription() const; int GetNumModChanges() const;