add ProfileManager::SaveAllProfiles

make ProfileManager::SaveMachineProfile() const
This commit is contained in:
Glenn Maynard
2004-07-20 01:31:23 +00:00
parent d44e35b889
commit 0047e04998
3 changed files with 18 additions and 5 deletions
+1 -2
View File
@@ -359,14 +359,13 @@ void GameState::EndGame()
CHECKPOINT; CHECKPOINT;
} }
BOOKKEEPER->WriteToDisk(); BOOKKEEPER->WriteToDisk();
PROFILEMAN->SaveMachineProfile(); PROFILEMAN->SaveAllProfiles();
FOREACH_HumanPlayer( pn ) FOREACH_HumanPlayer( pn )
{ {
if( !PROFILEMAN->IsUsingProfile(pn) ) if( !PROFILEMAN->IsUsingProfile(pn) )
continue; continue;
PROFILEMAN->SaveProfile( pn );
PROFILEMAN->UnloadProfile( pn ); PROFILEMAN->UnloadProfile( pn );
} }
+15 -2
View File
@@ -190,6 +190,19 @@ bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn, bool bLoadNames
return false; return false;
} }
void ProfileManager::SaveAllProfiles() const
{
this->SaveMachineProfile();
FOREACH_HumanPlayer( pn )
{
if( !this->IsUsingProfile(pn) )
continue;
this->SaveProfile( pn );
}
}
bool ProfileManager::SaveProfile( PlayerNumber pn ) const bool ProfileManager::SaveProfile( PlayerNumber pn ) const
{ {
if( m_sProfileDir[pn].empty() ) if( m_sProfileDir[pn].empty() )
@@ -294,12 +307,12 @@ bool ProfileManager::DeleteLocalProfile( CString sProfileID )
return FILEMAN->Remove( sProfileDir ); return FILEMAN->Remove( sProfileDir );
} }
void ProfileManager::SaveMachineProfile() void ProfileManager::SaveMachineProfile() const
{ {
// If the machine name has changed, make sure we use the new name. // If the machine name has changed, make sure we use the new name.
// It's important that this name be applied before the Player profiles // It's important that this name be applied before the Player profiles
// are saved, so that the Player's profiles show the right machine name. // are saved, so that the Player's profiles show the right machine name.
m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName; const_cast<ProfileManager *> (this)->m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName;
m_MachineProfile.SaveAllToDir( MACHINE_PROFILE_DIR, false ); /* don't sign machine profiles */ m_MachineProfile.SaveAllToDir( MACHINE_PROFILE_DIR, false ); /* don't sign machine profiles */
} }
+2 -1
View File
@@ -27,6 +27,7 @@ public:
bool LoadFirstAvailableProfile( PlayerNumber pn, bool bLoadNamesOnly ); // memory card or local profile bool LoadFirstAvailableProfile( PlayerNumber pn, bool bLoadNamesOnly ); // memory card or local profile
bool LoadProfileFromMemoryCard( PlayerNumber pn, bool bLoadNamesOnly ); bool LoadProfileFromMemoryCard( PlayerNumber pn, bool bLoadNamesOnly );
void SaveAllProfiles() const;
bool SaveProfile( PlayerNumber pn ) const; bool SaveProfile( PlayerNumber pn ) const;
void UnloadProfile( PlayerNumber pn ); void UnloadProfile( PlayerNumber pn );
@@ -41,7 +42,7 @@ public:
// High scores // High scores
// //
void LoadMachineProfile(); void LoadMachineProfile();
void SaveMachineProfile(); void SaveMachineProfile() const;
bool IsUsingProfile( PlayerNumber pn ) const { return !m_sProfileDir[pn].empty(); } bool IsUsingProfile( PlayerNumber pn ) const { return !m_sProfileDir[pn].empty(); }
bool IsUsingProfile( ProfileSlot slot ) const; bool IsUsingProfile( ProfileSlot slot ) const;