Skip to content

Commit

Permalink
allow playlists to show up as groups on the music wheel, delete the l…
Browse files Browse the repository at this point in the history
…oading window after songload so it doesn't overlap with scoreman's
  • Loading branch information
MinaciousGrace committed Jun 3, 2017
1 parent 084da49 commit b4138dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/SongManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void SongManager::InitAll( LoadingWindow *ld )
m_GroupsToNeverCache.insert(*group);
}
InitSongsFromDisk( ld );
SAFE_DELETE(ld); // Destroy this before the scoremanager loading window is created
}

static LocalizedString RELOADING ( "SongManager", "Reloading..." );
Expand Down Expand Up @@ -341,6 +342,12 @@ void Playlist::LoadFromNode(const XNode* node) {

for (size_t i = 0; i < chartlist.size(); ++i)
chartrates.emplace_back(chartlist[i].rate);

vector<Song*> playlistgroup;
for (auto& n : chartlist)
playlistgroup.emplace_back(SONGMAN->GetSongByChartkey(n.key));

SONGMAN->groupderps[name] = playlistgroup;
}

vector<string> Playlist::GetKeys() {
Expand All @@ -366,6 +373,9 @@ void SongManager::AddKeyedPointers(Song* new_song) {
}
}
}

groupderps[new_song->m_sGroupName].emplace_back(new_song);
SongUtil::SortSongPointerArrayByTitle(groupderps[new_song->m_sGroupName]);
}

// Get a steps pointer given a chartkey, the assumption here is we want _a_ matching steps, not the original steps - mina
Expand Down Expand Up @@ -782,7 +792,7 @@ RageColor SongManager::GetSongGroupColor( const RString &sSongGroup ) const
{
for( unsigned i=0; i<m_sSongGroupNames.size(); i++ )
{
if( m_sSongGroupNames[i] == sSongGroup )
if( m_sSongGroupNames[i] == sSongGroup || allplaylists.count(sSongGroup))
{
return SONG_GROUP_COLOR.GetValue( i%NUM_SONG_GROUP_COLORS );
}
Expand Down
2 changes: 2 additions & 0 deletions src/SongManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ class SongManager
map<string, Playlist> allplaylists;
string activeplaylist;
string playlistcourse;

map<string, vector<Song*>> groupderps;
protected:
void LoadStepManiaSongDir( RString sDir, LoadingWindow *ld );
void LoadDWISongDir( const RString &sDir );
Expand Down

0 comments on commit b4138dc

Please sign in to comment.