If a course uses a song that is disabled, disable the course too.

This commit is contained in:
Glenn Maynard
2007-08-15 20:37:34 +00:00
parent 85732aa4c8
commit 83d64246d9
2 changed files with 15 additions and 2 deletions
+3 -2
View File
@@ -138,7 +138,8 @@ void CatalogXml::Save( LoadingWindow *loading_window )
// the title.
if( !pCourse->AllSongsAreFixed() )
continue;
if( UNLOCKMAN->CourseIsLocked(pCourse) )
/* Don't write locked songs to the catalog, but do write disabled songs. */
if( UNLOCKMAN->CourseIsLocked(pCourse) & ~LOCKED_DISABLED )
continue;
iTotalCourses++;
}
@@ -233,7 +234,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
// the title.
if( !pCourse->AllSongsAreFixed() )
continue;
if( UNLOCKMAN->CourseIsLocked(pCourse) )
if( UNLOCKMAN->CourseIsLocked(pCourse) & ~LOCKED_DISABLED )
continue;
CourseID courseID;
+12
View File
@@ -118,6 +118,18 @@ int UnlockManager::CourseIsLocked( const Course *pCourse ) const
iRet |= LOCKED_LOCK;
}
/* If a course uses a song that is disabled, disable the course too. */
FOREACH_CONST( CourseEntry, pCourse->m_vEntries, e )
{
const CourseEntry &ce = *e;
const Song *pSong = ce.songID.ToSong();
if( pSong == NULL )
continue;
int iSongLock = SongIsLocked( pSong );
if( iSongLock & LOCKED_DISABLED )
iRet |= LOCKED_DISABLED;
}
return iRet;
}