From 03b798321696e3f7719fe1addcf3fd56f7e8ef85 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 16 Aug 2007 01:24:55 +0000 Subject: [PATCH] merge UnlockManager::SongIsRouletteOnly into SongIsLocked --- stepmania/src/MusicWheel.cpp | 2 +- stepmania/src/UnlockManager.cpp | 21 ++++----------------- stepmania/src/UnlockManager.h | 8 +++++--- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 4f65035df3..01eabed48d 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -353,7 +353,7 @@ void MusicWheel::GetSongList( vector &arraySongs, SortOrder so, const RSt /* Hide songs that asked to be hidden via #SELECTABLE. */ if( iLocked & LOCKED_SELECTABLE ) continue; - if( so!=SORT_ROULETTE && UNLOCKMAN->SongIsRouletteOnly( pSong ) ) + if( so != SORT_ROULETTE && iLocked & LOCKED_ROULETTE ) continue; } diff --git a/stepmania/src/UnlockManager.cpp b/stepmania/src/UnlockManager.cpp index e020928900..43a9290c14 100644 --- a/stepmania/src/UnlockManager.cpp +++ b/stepmania/src/UnlockManager.cpp @@ -140,7 +140,11 @@ int UnlockManager::SongIsLocked( const Song *pSong ) const { const UnlockEntry *p = FindSong( pSong ); if( p != NULL && p->IsLocked() ) + { iRet |= LOCKED_LOCK; + if( !p->m_sEntryID.empty() && m_RouletteCodes.find( p->m_sEntryID ) != m_RouletteCodes.end() ) + iRet |= LOCKED_ROULETTE; + } } if( PREFSMAN->m_bHiddenSongs && pSong->m_SelectionDisplay == Song::SHOW_NEVER ) iRet |= LOCKED_SELECTABLE; @@ -149,23 +153,6 @@ int UnlockManager::SongIsLocked( const Song *pSong ) const return iRet; } -/* Return true if the song is *only* available in roulette. */ -bool UnlockManager::SongIsRouletteOnly( const Song *song ) const -{ - if( !PREFSMAN->m_bUseUnlockSystem ) - return false; - - const UnlockEntry *p = FindSong( song ); - if( p == NULL ) - return false; - - /* If the song is locked by a code, and it's a roulette code, honor IsLocked. */ - if( p->m_sEntryID.empty() || m_RouletteCodes.find( p->m_sEntryID ) == m_RouletteCodes.end() ) - return false; - - return p->IsLocked(); -} - bool UnlockManager::StepsIsLocked( const Song *pSong, const Steps *pSteps ) const { if( !PREFSMAN->m_bUseUnlockSystem ) diff --git a/stepmania/src/UnlockManager.h b/stepmania/src/UnlockManager.h index 7337b288b6..ff2b30cb37 100644 --- a/stepmania/src/UnlockManager.h +++ b/stepmania/src/UnlockManager.h @@ -93,12 +93,15 @@ public: // Option is locked due to an unsatisfied unlock entry. #define LOCKED_LOCK 0x1 +// Option is only available in random selections. +#define LOCKED_ROULETTE 0x2 + // Option is locked due to a #SELECTABLE tag. -#define LOCKED_SELECTABLE 0x2 +#define LOCKED_SELECTABLE 0x4 // Option is disabled by the operator. (For courses, this means that a song in the // course is disabled.) -#define LOCKED_DISABLED 0x4 +#define LOCKED_DISABLED 0x8 class UnlockManager { @@ -111,7 +114,6 @@ public: float PointsUntilNextUnlock( UnlockRequirement t ) const; int SongIsLocked( const Song *pSong ) const; - bool SongIsRouletteOnly( const Song *song ) const; bool StepsIsLocked( const Song *pSong, const Steps *pSteps ) const; int CourseIsLocked( const Course *course ) const; bool ModifierIsLocked( const RString &sOneMod ) const;