Fix a crash that occured when changing themes that had differing numbers of song/course group colors.

This commit is contained in:
AJ Kelly
2010-06-03 23:14:55 -05:00
parent a85a9e36b8
commit 3254bfe804
4 changed files with 70 additions and 58 deletions
+13 -7
View File
@@ -126,13 +126,6 @@ void SongManager::Reload( bool bAllowFastLoad, LoadingWindow *ld )
PREFSMAN->m_bFastLoad.Set( OldVal );
UpdatePreferredSort();
// Reload song/course group colors to prevent a crash when switching
// themes in-game. (apparently not, though.) -aj
NUM_SONG_GROUP_COLORS .Load( "SongManager", "NumSongGroupColors" );
SONG_GROUP_COLOR .Load( "SongManager", SONG_GROUP_COLOR_NAME, NUM_SONG_GROUP_COLORS );
NUM_COURSE_GROUP_COLORS .Load( "SongManager", "NumCourseGroupColors" );
COURSE_GROUP_COLOR .Load( "SongManager", COURSE_GROUP_COLOR_NAME, NUM_COURSE_GROUP_COLORS );
}
void SongManager::InitSongsFromDisk( LoadingWindow *ld )
@@ -576,6 +569,19 @@ RageColor SongManager::GetCourseColor( const Course* pCourse ) const
}
}
void SongManager::ResetGroupColors()
{
// Reload song/course group colors to prevent a crash when switching
// themes in-game. (apparently not, though.) -aj
SONG_GROUP_COLOR.Clear();
COURSE_GROUP_COLOR.Clear();
NUM_SONG_GROUP_COLORS .Load( "SongManager", "NumSongGroupColors" );
SONG_GROUP_COLOR .Load( "SongManager", SONG_GROUP_COLOR_NAME, NUM_SONG_GROUP_COLORS );
NUM_COURSE_GROUP_COLORS .Load( "SongManager", "NumCourseGroupColors" );
COURSE_GROUP_COLOR .Load( "SongManager", COURSE_GROUP_COLOR_NAME, NUM_COURSE_GROUP_COLORS );
}
const vector<Song*> &SongManager::GetSongs( const RString &sGroupName ) const
{
static const vector<Song*> vEmpty;