Remove a CMap. This is simpler, anyway.
This commit is contained in:
@@ -79,21 +79,18 @@ ScreenSelectGroup::ScreenSelectGroup()
|
|||||||
aAllSongs.RemoveAt( i );
|
aAllSongs.RemoveAt( i );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get group names by thowing them into a hash
|
|
||||||
CMapStringToString mapGroupToNothing;
|
|
||||||
for( i=0; i<aAllSongs.GetSize(); i++ ) // foreach Song
|
|
||||||
mapGroupToNothing[ aAllSongs[i]->m_sGroupName ] = "";
|
|
||||||
|
|
||||||
CStringArray asGroupNames;
|
CStringArray asGroupNames;
|
||||||
|
for( i=0; i<aAllSongs.GetSize(); i++ ) {
|
||||||
// Read group names back out into asGroupNames
|
asGroupNames.Add( aAllSongs[i]->m_sGroupName );
|
||||||
for( POSITION pos = mapGroupToNothing.GetStartPosition(); pos != NULL; )
|
|
||||||
{
|
|
||||||
CString sGroupName, sValue;
|
|
||||||
mapGroupToNothing.GetNextAssoc( pos, sGroupName, sValue );
|
|
||||||
asGroupNames.Add( sGroupName );
|
|
||||||
}
|
}
|
||||||
SortCStringArray( asGroupNames, true );
|
|
||||||
|
/* Remove duplicate groups. */
|
||||||
|
SortCStringArray(asGroupNames, true);
|
||||||
|
for( i=asGroupNames.GetSize()-1; i > 0; --i ) {
|
||||||
|
if( asGroupNames[i] == asGroupNames[i-1] )
|
||||||
|
asGroupNames.RemoveAt( i );
|
||||||
|
}
|
||||||
|
|
||||||
asGroupNames.InsertAt(0, "ALL MUSIC" );
|
asGroupNames.InsertAt(0, "ALL MUSIC" );
|
||||||
|
|
||||||
// Add songs to the MusicList.
|
// Add songs to the MusicList.
|
||||||
|
|||||||
Reference in New Issue
Block a user