const fixes

This commit is contained in:
Glenn Maynard
2004-02-22 21:25:22 +00:00
parent 06a3aea227
commit 95edf1db8a
3 changed files with 20 additions and 19 deletions
+2 -2
View File
@@ -119,7 +119,7 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName )
DisplayedSong = UNLOCKMAN->m_SongEntries[i-1].m_sSongName; DisplayedSong = UNLOCKMAN->m_SongEntries[i-1].m_sSongName;
DisplayedSong.MakeUpper(); DisplayedSong.MakeUpper();
UnlockEntry *pSong = UNLOCKMAN->FindLockEntry(DisplayedSong); const UnlockEntry *pSong = UNLOCKMAN->FindLockEntry(DisplayedSong);
if ( pSong == NULL ) // no such song if ( pSong == NULL ) // no such song
continue; continue;
@@ -247,7 +247,7 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName )
} }
DisplayedSong.MakeUpper(); DisplayedSong.MakeUpper();
UnlockEntry *pSong = UNLOCKMAN->FindLockEntry(DisplayedSong); const UnlockEntry *pSong = UNLOCKMAN->FindLockEntry(DisplayedSong);
if (pSong->m_pSong == NULL) if (pSong->m_pSong == NULL)
continue; continue;
+8 -8
View File
@@ -55,24 +55,24 @@ void UnlockSystem::UnlockSong( const Song *song )
UnlockCode( p->m_iCode ); UnlockCode( p->m_iCode );
} }
bool UnlockSystem::CourseIsLocked( const Course *course ) bool UnlockSystem::CourseIsLocked( const Course *course ) const
{ {
if( !PREFSMAN->m_bUseUnlockSystem ) if( !PREFSMAN->m_bUseUnlockSystem )
return false; return false;
UnlockEntry *p = FindCourse( course ); const UnlockEntry *p = FindCourse( course );
if( p == NULL ) if( p == NULL )
return false; return false;
return p->IsLocked(); return p->IsLocked();
} }
bool UnlockSystem::SongIsLocked( const Song *song ) bool UnlockSystem::SongIsLocked( const Song *song ) const
{ {
if( !PREFSMAN->m_bUseUnlockSystem ) if( !PREFSMAN->m_bUseUnlockSystem )
return false; return false;
UnlockEntry *p = FindSong( song ); const UnlockEntry *p = FindSong( song );
if( p == NULL ) if( p == NULL )
return false; return false;
@@ -80,7 +80,7 @@ bool UnlockSystem::SongIsLocked( const Song *song )
} }
/* Return true if the song is available in roulette (overriding #SELECTABLE). */ /* Return true if the song is available in roulette (overriding #SELECTABLE). */
bool UnlockSystem::SongIsRoulette( const Song *song ) bool UnlockSystem::SongIsRoulette( const Song *song ) const
{ {
if( !PREFSMAN->m_bUseUnlockSystem ) if( !PREFSMAN->m_bUseUnlockSystem )
return false; return false;
@@ -96,7 +96,7 @@ bool UnlockSystem::SongIsRoulette( const Song *song )
return true; return true;
} }
UnlockEntry *UnlockSystem::FindLockEntry( CString songname ) const UnlockEntry *UnlockSystem::FindLockEntry( CString songname ) const
{ {
for( unsigned i = 0; i < m_SongEntries.size(); i++ ) for( unsigned i = 0; i < m_SongEntries.size(); i++ )
if( !songname.CompareNoCase(m_SongEntries[i].m_sSongName) ) if( !songname.CompareNoCase(m_SongEntries[i].m_sSongName) )
@@ -105,7 +105,7 @@ UnlockEntry *UnlockSystem::FindLockEntry( CString songname )
return NULL; return NULL;
} }
UnlockEntry *UnlockSystem::FindSong( const Song *pSong ) const UnlockEntry *UnlockSystem::FindSong( const Song *pSong ) const
{ {
for( unsigned i = 0; i < m_SongEntries.size(); i++ ) for( unsigned i = 0; i < m_SongEntries.size(); i++ )
if( m_SongEntries[i].m_pSong == pSong ) if( m_SongEntries[i].m_pSong == pSong )
@@ -114,7 +114,7 @@ UnlockEntry *UnlockSystem::FindSong( const Song *pSong )
return NULL; return NULL;
} }
UnlockEntry *UnlockSystem::FindCourse( const Course *pCourse ) const UnlockEntry *UnlockSystem::FindCourse( const Course *pCourse ) const
{ {
for(unsigned i = 0; i < m_SongEntries.size(); i++) for(unsigned i = 0; i < m_SongEntries.size(); i++)
if (m_SongEntries[i].m_pCourse== pCourse ) if (m_SongEntries[i].m_pCourse== pCourse )
+10 -9
View File
@@ -65,33 +65,34 @@ public:
float SongPointsUntilNextUnlock() const { return PointsUntilNextUnlock(UNLOCK_SONG_POINTS); } float SongPointsUntilNextUnlock() const { return PointsUntilNextUnlock(UNLOCK_SONG_POINTS); }
// Used on select screens: // Used on select screens:
bool SongIsLocked( const Song *song ); bool SongIsLocked( const Song *song ) const;
bool SongIsRoulette( const Song *song ); bool SongIsRoulette( const Song *song ) const;
bool CourseIsLocked( const Course *course ); bool CourseIsLocked( const Course *course ) const;
// Gets number of unlocks for title screen // Gets number of unlocks for title screen
int GetNumUnlocks() const; int GetNumUnlocks() const;
void UpdateSongs(); const UnlockEntry *FindLockEntry( CString lockname ) const;
void GetPoints( const Profile *pProfile, float fScores[NUM_UNLOCK_TYPES] ) const;
void UnlockCode( int num ); void UnlockCode( int num );
// unlocks the song's code // unlocks the song's code
void UnlockSong( const Song *song ); void UnlockSong( const Song *song );
UnlockEntry *FindLockEntry( CString lockname );
// All locked songs are stored here // All locked songs are stored here
vector<UnlockEntry> m_SongEntries; vector<UnlockEntry> m_SongEntries;
void GetPoints( const Profile *pProfile, float fScores[NUM_UNLOCK_TYPES] ) const; // If global song or course points change, call to update
void UpdateSongs();
private: private:
// read unlocks // read unlocks
bool Load(); bool Load();
UnlockEntry *FindSong( const Song *pSong ); const UnlockEntry *FindSong( const Song *pSong ) const;
UnlockEntry *FindCourse( const Course *pCourse ); const UnlockEntry *FindCourse( const Course *pCourse ) const;
set<int> m_RouletteCodes; // "codes" which are available in roulette and which unlock if rouletted set<int> m_RouletteCodes; // "codes" which are available in roulette and which unlock if rouletted
}; };