simplify into one loop
This commit is contained in:
@@ -544,6 +544,7 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
|
|||||||
/* We're using sections, so use the section name as the top-level sort. */
|
/* We're using sections, so use the section name as the top-level sort. */
|
||||||
if( so != SORT_TOP_GRADES && so != SORT_BPM )
|
if( so != SORT_TOP_GRADES && so != SORT_BPM )
|
||||||
SongUtil::SortSongPointerArrayBySectionName(arraySongs, so);
|
SongUtil::SortSongPointerArrayBySectionName(arraySongs, so);
|
||||||
|
}
|
||||||
|
|
||||||
// make WheelItemDatas with sections
|
// make WheelItemDatas with sections
|
||||||
CString sLastSection = "";
|
CString sLastSection = "";
|
||||||
@@ -551,6 +552,8 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
|
|||||||
for( unsigned i=0; i< arraySongs.size(); i++ )
|
for( unsigned i=0; i< arraySongs.size(); i++ )
|
||||||
{
|
{
|
||||||
Song* pSong = arraySongs[i];
|
Song* pSong = arraySongs[i];
|
||||||
|
if( bUseSections )
|
||||||
|
{
|
||||||
CString sThisSection = SongUtil::GetSectionNameFromSongAndSort( pSong, so );
|
CString sThisSection = SongUtil::GetSectionNameFromSongAndSort( pSong, so );
|
||||||
|
|
||||||
if( sThisSection != sLastSection )
|
if( sThisSection != sLastSection )
|
||||||
@@ -561,17 +564,8 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
|
|||||||
arrayWheelItemDatas.push_back( WheelItemData(TYPE_SECTION, NULL, sThisSection, NULL, colorSection) );
|
arrayWheelItemDatas.push_back( WheelItemData(TYPE_SECTION, NULL, sThisSection, NULL, colorSection) );
|
||||||
sLastSection = sThisSection;
|
sLastSection = sThisSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayWheelItemDatas.push_back( WheelItemData( TYPE_SONG, pSong, sThisSection, NULL, SONGMAN->GetSongColor(pSong)) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<arraySongs.size(); i++ )
|
|
||||||
{
|
|
||||||
Song* pSong = arraySongs[i];
|
|
||||||
arrayWheelItemDatas.push_back( WheelItemData(TYPE_SONG, pSong, "", NULL, SONGMAN->GetSongColor(pSong)) );
|
|
||||||
}
|
}
|
||||||
|
arrayWheelItemDatas.push_back( WheelItemData(TYPE_SONG, pSong, sLastSection, NULL, SONGMAN->GetSongColor(pSong)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( so != SORT_ROULETTE )
|
if( so != SORT_ROULETTE )
|
||||||
|
|||||||
Reference in New Issue
Block a user