diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 30c229e120..5c89115f6b 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -25,13 +25,10 @@ Course::Course() { - m_iStages = 0; m_bRepeat = false; m_bRandomize = false; m_iLives = 4; m_iExtra = 0; - for( int i=0; i &apSongs ) @@ -183,13 +180,13 @@ void Course::Shuffle() { /* Shuffle the list. */ for( int i = 0; i < GetNumStages(); ++i) - swap(SongOrdering[i], SongOrdering[rand() % GetNumStages()]); + swap(order[i], order[rand() % GetNumStages()]); } Notes* Course::GetNotesForStage( int iStage ) { - Song* pSong = m_apSongs[iStage]; - CString sDescription = m_asDescriptions[iStage]; + Song* pSong = GetSong(iStage); + CString sDescription = entries[iStage].description; unsigned i; for( i=0; im_apNotes.size(); i++ ) @@ -218,28 +215,28 @@ Notes* Course::GetNotesForStage( int iStage ) Song *Course::GetSong( int iStage ) const { - return m_apSongs[iStage]; + return entries[iStage].song; } CString Course::GetDescription( int iStage ) const { - return m_asDescriptions[iStage]; + return entries[iStage].description; } CString Course::GetModifiers( int iStage ) const { - return m_asModifiers[iStage]; + return entries[iStage].modifiers; } void Course::AddStage( Song* pSong, CString sDescription, CString sModifiers ) { - ASSERT( m_iStages <= MAX_COURSE_STAGES - 1 ); - m_apSongs[m_iStages] = pSong; - m_asDescriptions[m_iStages] = sDescription; - m_asModifiers[m_iStages] = sModifiers; - SongOrdering[m_iStages] = m_iStages; + course_entry e; + e.song = pSong; + e.description = sDescription; + e.modifiers = sModifiers; + entries.push_back(e); - m_iStages++; + order.push_back(order.size()); } /* When bShuffled is true, returns courses in the song ordering list. */ @@ -251,11 +248,11 @@ void Course::GetSongAndNotesForCurrentStyle( { for( int i=0; iHasMusic() ) continue; // skip @@ -294,7 +291,7 @@ void Course::GetSongOptions( SongOptions* pSO_out ) int Course::GetNumStages() const { - return m_iStages; + return entries.size(); } // diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index c645fecc98..268d11c7a3 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -12,22 +12,24 @@ */ #include "GameConstantsAndTypes.h" + struct PlayerOptions; struct SongOptions; class Song; struct Notes; - -const int MAX_COURSE_STAGES = 300; // Increased since the user can place all Bemani songs in a single folder - - class Course { - CString m_asDescriptions[MAX_COURSE_STAGES]; - CString m_asModifiers[MAX_COURSE_STAGES]; // set player and song options from these - Song* m_apSongs[MAX_COURSE_STAGES]; int m_iStages; + struct course_entry { + CString description; + CString modifiers; // set player and song options from these + Song *song; + }; + vector entries; + vector order; + public: Course(); @@ -56,7 +58,6 @@ public: RageColor GetColor(); private: - int SongOrdering[MAX_COURSE_STAGES]; void Shuffle(); };