From 83d64246d92397c01e89501fa22802148f7cca1b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 15 Aug 2007 20:37:34 +0000 Subject: [PATCH] If a course uses a song that is disabled, disable the course too. --- stepmania/src/CatalogXml.cpp | 5 +++-- stepmania/src/UnlockManager.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/stepmania/src/CatalogXml.cpp b/stepmania/src/CatalogXml.cpp index b1344e6fce..d6ec209b41 100644 --- a/stepmania/src/CatalogXml.cpp +++ b/stepmania/src/CatalogXml.cpp @@ -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; diff --git a/stepmania/src/UnlockManager.cpp b/stepmania/src/UnlockManager.cpp index 01b2d4d078..4bbf0fd795 100644 --- a/stepmania/src/UnlockManager.cpp +++ b/stepmania/src/UnlockManager.cpp @@ -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; }