From 8d7f11d7567dd0974e52a5386b6f58ce32e406b2 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 22 Feb 2004 02:01:40 +0000 Subject: [PATCH] const --- stepmania/src/ProfileManager.cpp | 20 +++++++++++--------- stepmania/src/ProfileManager.h | 18 +++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 0acd0219de..f0173f3db7 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -72,20 +72,22 @@ ProfileManager::~ProfileManager() SaveMachineProfile(); } -void ProfileManager::GetLocalProfileIDs( vector &asProfileIDsOut ) +void ProfileManager::GetLocalProfileIDs( vector &asProfileIDsOut ) const { GetDirListing( USER_PROFILES_DIR "*", asProfileIDsOut, true, false ); } -void ProfileManager::GetLocalProfileNames( vector &asNamesOut ) +void ProfileManager::GetLocalProfileNames( vector &asNamesOut ) const { CStringArray vsProfileIDs; GetLocalProfileIDs( vsProfileIDs ); + LOG->Trace("GetLocalProfileNames: %i", vsProfileIDs.size()); for( unsigned i=0; iTrace(" '%s'", sDisplayName.c_str()); asNamesOut.push_back( sDisplayName ); } } @@ -200,7 +202,7 @@ bool ProfileManager::CreateMemoryCardProfile( PlayerNumber pn ) // return false; //} -bool ProfileManager::SaveProfile( PlayerNumber pn ) +bool ProfileManager::SaveProfile( PlayerNumber pn ) const { if( m_sProfileDir[pn].empty() ) return false; @@ -223,9 +225,9 @@ const Profile* ProfileManager::GetProfile( PlayerNumber pn ) const return &m_Profile[pn]; } -CString ProfileManager::GetPlayerName( PlayerNumber pn ) +CString ProfileManager::GetPlayerName( PlayerNumber pn ) const { - Profile *prof = GetProfile( pn ); + const Profile *prof = GetProfile( pn ); if( prof ) return prof->m_sLastUsedHighScoreName; @@ -388,12 +390,12 @@ void ProfileManager::ReadSM300NoteScores() } */ -bool ProfileManager::ProfileWasLoadedFromMemoryCard( PlayerNumber pn ) +bool ProfileManager::ProfileWasLoadedFromMemoryCard( PlayerNumber pn ) const { return GetProfile(pn) && m_bWasLoadedFromMemoryCard[pn]; } -CString ProfileManager::GetProfileDir( ProfileSlot slot ) +CString ProfileManager::GetProfileDir( ProfileSlot slot ) const { switch( slot ) { @@ -450,14 +452,14 @@ void ProfileManager::IncrementStepsPlayCount( const Steps* pSteps, PlayerNumber PROFILEMAN->GetMachineProfile()->IncrementStepsPlayCount( pSteps ); } -HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot slot, Difficulty dc ) +HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot slot, Difficulty dc ) const { // return max grade of notes in difficulty class vector aNotes; s->GetSteps( aNotes, st->m_StepsType ); SortNotesArrayByDifficulty( aNotes ); - Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc ); + const Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc ); if( PROFILEMAN->IsUsingProfile(slot) ) return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSteps).GetTopScore(); diff --git a/stepmania/src/ProfileManager.h b/stepmania/src/ProfileManager.h index 97098f945a..a195764870 100644 --- a/stepmania/src/ProfileManager.h +++ b/stepmania/src/ProfileManager.h @@ -30,12 +30,12 @@ public: bool RenameLocalProfile( CString sProfileID, CString sNewName ); bool DeleteLocalProfile( CString sProfileID ); - void GetLocalProfileIDs( vector &asProfileIDsOut ); - void GetLocalProfileNames( vector &asNamesOut ); + void GetLocalProfileIDs( vector &asProfileIDsOut ) const; + void GetLocalProfileNames( vector &asNamesOut ) const; bool LoadProfileFromMemoryCard( PlayerNumber pn ); // bool LoadFirstAvailableProfile( PlayerNumber pn ); // memory card or local profile - bool SaveProfile( PlayerNumber pn ); + bool SaveProfile( PlayerNumber pn ) const; void UnloadProfile( PlayerNumber pn ); // @@ -44,8 +44,8 @@ public: void LoadMachineProfile(); void SaveMachineProfile(); - bool IsUsingProfile( PlayerNumber pn ) { return !m_sProfileDir[pn].empty(); } - bool IsUsingProfile( ProfileSlot slot ) + bool IsUsingProfile( PlayerNumber pn ) const { return !m_sProfileDir[pn].empty(); } + bool IsUsingProfile( ProfileSlot slot ) const { switch( slot ) { @@ -63,12 +63,12 @@ public: Profile* GetProfile( PlayerNumber pn ) { return (Profile*) ((const ProfileManager *) this)->GetProfile(pn); } const Profile* GetProfile( ProfileSlot slot ) const; Profile* GetProfile( ProfileSlot slot ) { return (Profile*) ((const ProfileManager *) this)->GetProfile(slot); } - CString GetProfileDir( ProfileSlot slot ); + CString GetProfileDir( ProfileSlot slot ) const; Profile* GetMachineProfile() { return &m_MachineProfile; } - CString GetPlayerName( PlayerNumber pn ); - bool ProfileWasLoadedFromMemoryCard( PlayerNumber pn ); + CString GetPlayerName( PlayerNumber pn ) const; + bool ProfileWasLoadedFromMemoryCard( PlayerNumber pn ) const; @@ -79,7 +79,7 @@ public: bool IsSongNew( const Song* pSong ) const { return GetSongNumTimesPlayed(pSong,PROFILE_SLOT_MACHINE)==0; } void AddStepsHighScore( const Steps* pSteps, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut ); void IncrementStepsPlayCount( const Steps* pSteps, PlayerNumber pn ); - HighScore GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot slot, Difficulty dc ); + HighScore GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot slot, Difficulty dc ) const; // // Course stats