This commit is contained in:
Glenn Maynard
2004-02-22 02:01:40 +00:00
parent 8b146986f0
commit 8d7f11d756
2 changed files with 20 additions and 18 deletions
+11 -9
View File
@@ -72,20 +72,22 @@ ProfileManager::~ProfileManager()
SaveMachineProfile(); SaveMachineProfile();
} }
void ProfileManager::GetLocalProfileIDs( vector<CString> &asProfileIDsOut ) void ProfileManager::GetLocalProfileIDs( vector<CString> &asProfileIDsOut ) const
{ {
GetDirListing( USER_PROFILES_DIR "*", asProfileIDsOut, true, false ); GetDirListing( USER_PROFILES_DIR "*", asProfileIDsOut, true, false );
} }
void ProfileManager::GetLocalProfileNames( vector<CString> &asNamesOut ) void ProfileManager::GetLocalProfileNames( vector<CString> &asNamesOut ) const
{ {
CStringArray vsProfileIDs; CStringArray vsProfileIDs;
GetLocalProfileIDs( vsProfileIDs ); GetLocalProfileIDs( vsProfileIDs );
LOG->Trace("GetLocalProfileNames: %i", vsProfileIDs.size());
for( unsigned i=0; i<vsProfileIDs.size(); i++ ) for( unsigned i=0; i<vsProfileIDs.size(); i++ )
{ {
CString sProfileID = vsProfileIDs[i]; CString sProfileID = vsProfileIDs[i];
CString sProfileDir = USER_PROFILES_DIR + sProfileID + "/"; CString sProfileDir = USER_PROFILES_DIR + sProfileID + "/";
CString sDisplayName = Profile::GetProfileDisplayNameFromDir( sProfileDir ); CString sDisplayName = Profile::GetProfileDisplayNameFromDir( sProfileDir );
LOG->Trace(" '%s'", sDisplayName.c_str());
asNamesOut.push_back( sDisplayName ); asNamesOut.push_back( sDisplayName );
} }
} }
@@ -200,7 +202,7 @@ bool ProfileManager::CreateMemoryCardProfile( PlayerNumber pn )
// return false; // return false;
//} //}
bool ProfileManager::SaveProfile( PlayerNumber pn ) bool ProfileManager::SaveProfile( PlayerNumber pn ) const
{ {
if( m_sProfileDir[pn].empty() ) if( m_sProfileDir[pn].empty() )
return false; return false;
@@ -223,9 +225,9 @@ const Profile* ProfileManager::GetProfile( PlayerNumber pn ) const
return &m_Profile[pn]; 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 ) if( prof )
return prof->m_sLastUsedHighScoreName; 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]; return GetProfile(pn) && m_bWasLoadedFromMemoryCard[pn];
} }
CString ProfileManager::GetProfileDir( ProfileSlot slot ) CString ProfileManager::GetProfileDir( ProfileSlot slot ) const
{ {
switch( slot ) switch( slot )
{ {
@@ -450,14 +452,14 @@ void ProfileManager::IncrementStepsPlayCount( const Steps* pSteps, PlayerNumber
PROFILEMAN->GetMachineProfile()->IncrementStepsPlayCount( pSteps ); 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 // return max grade of notes in difficulty class
vector<Steps*> aNotes; vector<Steps*> aNotes;
s->GetSteps( aNotes, st->m_StepsType ); s->GetSteps( aNotes, st->m_StepsType );
SortNotesArrayByDifficulty( aNotes ); SortNotesArrayByDifficulty( aNotes );
Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc ); const Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc );
if( PROFILEMAN->IsUsingProfile(slot) ) if( PROFILEMAN->IsUsingProfile(slot) )
return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSteps).GetTopScore(); return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSteps).GetTopScore();
+9 -9
View File
@@ -30,12 +30,12 @@ public:
bool RenameLocalProfile( CString sProfileID, CString sNewName ); bool RenameLocalProfile( CString sProfileID, CString sNewName );
bool DeleteLocalProfile( CString sProfileID ); bool DeleteLocalProfile( CString sProfileID );
void GetLocalProfileIDs( vector<CString> &asProfileIDsOut ); void GetLocalProfileIDs( vector<CString> &asProfileIDsOut ) const;
void GetLocalProfileNames( vector<CString> &asNamesOut ); void GetLocalProfileNames( vector<CString> &asNamesOut ) const;
bool LoadProfileFromMemoryCard( PlayerNumber pn ); bool LoadProfileFromMemoryCard( PlayerNumber pn );
// bool LoadFirstAvailableProfile( PlayerNumber pn ); // memory card or local profile // bool LoadFirstAvailableProfile( PlayerNumber pn ); // memory card or local profile
bool SaveProfile( PlayerNumber pn ); bool SaveProfile( PlayerNumber pn ) const;
void UnloadProfile( PlayerNumber pn ); void UnloadProfile( PlayerNumber pn );
// //
@@ -44,8 +44,8 @@ public:
void LoadMachineProfile(); void LoadMachineProfile();
void SaveMachineProfile(); void SaveMachineProfile();
bool IsUsingProfile( PlayerNumber pn ) { return !m_sProfileDir[pn].empty(); } bool IsUsingProfile( PlayerNumber pn ) const { return !m_sProfileDir[pn].empty(); }
bool IsUsingProfile( ProfileSlot slot ) bool IsUsingProfile( ProfileSlot slot ) const
{ {
switch( slot ) switch( slot )
{ {
@@ -63,12 +63,12 @@ public:
Profile* GetProfile( PlayerNumber pn ) { return (Profile*) ((const ProfileManager *) this)->GetProfile(pn); } Profile* GetProfile( PlayerNumber pn ) { return (Profile*) ((const ProfileManager *) this)->GetProfile(pn); }
const Profile* GetProfile( ProfileSlot slot ) const; const Profile* GetProfile( ProfileSlot slot ) const;
Profile* GetProfile( ProfileSlot slot ) { return (Profile*) ((const ProfileManager *) this)->GetProfile(slot); } 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; } Profile* GetMachineProfile() { return &m_MachineProfile; }
CString GetPlayerName( PlayerNumber pn ); CString GetPlayerName( PlayerNumber pn ) const;
bool ProfileWasLoadedFromMemoryCard( PlayerNumber pn ); bool ProfileWasLoadedFromMemoryCard( PlayerNumber pn ) const;
@@ -79,7 +79,7 @@ public:
bool IsSongNew( const Song* pSong ) const { return GetSongNumTimesPlayed(pSong,PROFILE_SLOT_MACHINE)==0; } 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 AddStepsHighScore( const Steps* pSteps, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut );
void IncrementStepsPlayCount( const Steps* pSteps, PlayerNumber pn ); 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 // Course stats