From b68e9dd77272284c2b1c580c1df230937461b2e3 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 9 Dec 2005 20:05:04 +0000 Subject: [PATCH] simplify into one loop --- stepmania/src/MusicWheel.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 5d4563f89f..96815ce5fd 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -544,13 +544,16 @@ void MusicWheel::BuildWheelItemDatas( vector &arrayWheelItemDatas /* We're using sections, so use the section name as the top-level sort. */ if( so != SORT_TOP_GRADES && so != SORT_BPM ) SongUtil::SortSongPointerArrayBySectionName(arraySongs, so); + } - // make WheelItemDatas with sections - CString sLastSection = ""; - int iSectionColorIndex = 0; - for( unsigned i=0; i< arraySongs.size(); i++ ) + // make WheelItemDatas with sections + CString sLastSection = ""; + int iSectionColorIndex = 0; + for( unsigned i=0; i< arraySongs.size(); i++ ) + { + Song* pSong = arraySongs[i]; + if( bUseSections ) { - Song* pSong = arraySongs[i]; CString sThisSection = SongUtil::GetSectionNameFromSongAndSort( pSong, so ); if( sThisSection != sLastSection ) @@ -561,17 +564,8 @@ void MusicWheel::BuildWheelItemDatas( vector &arrayWheelItemDatas arrayWheelItemDatas.push_back( WheelItemData(TYPE_SECTION, NULL, sThisSection, NULL, colorSection) ); sLastSection = sThisSection; } - - arrayWheelItemDatas.push_back( WheelItemData( TYPE_SONG, pSong, sThisSection, NULL, SONGMAN->GetSongColor(pSong)) ); - } - } - else - { - for( unsigned i=0; iGetSongColor(pSong)) ); } + arrayWheelItemDatas.push_back( WheelItemData(TYPE_SONG, pSong, sLastSection, NULL, SONGMAN->GetSongColor(pSong)) ); } if( so != SORT_ROULETTE )