diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 5e1b391293..74bee22722 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -359,14 +359,13 @@ void GameState::EndGame() CHECKPOINT; } BOOKKEEPER->WriteToDisk(); - PROFILEMAN->SaveMachineProfile(); + PROFILEMAN->SaveAllProfiles(); FOREACH_HumanPlayer( pn ) { if( !PROFILEMAN->IsUsingProfile(pn) ) continue; - PROFILEMAN->SaveProfile( pn ); PROFILEMAN->UnloadProfile( pn ); } diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index b8977ff659..4ff2632359 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -190,6 +190,19 @@ bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn, bool bLoadNames 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 { if( m_sProfileDir[pn].empty() ) @@ -294,12 +307,12 @@ bool ProfileManager::DeleteLocalProfile( CString sProfileID ) return FILEMAN->Remove( sProfileDir ); } -void ProfileManager::SaveMachineProfile() +void ProfileManager::SaveMachineProfile() const { // 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 // are saved, so that the Player's profiles show the right machine name. - m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName; + const_cast (this)->m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName; m_MachineProfile.SaveAllToDir( MACHINE_PROFILE_DIR, false ); /* don't sign machine profiles */ } diff --git a/stepmania/src/ProfileManager.h b/stepmania/src/ProfileManager.h index d2ad52076d..7dd5021777 100644 --- a/stepmania/src/ProfileManager.h +++ b/stepmania/src/ProfileManager.h @@ -27,6 +27,7 @@ public: bool LoadFirstAvailableProfile( PlayerNumber pn, bool bLoadNamesOnly ); // memory card or local profile bool LoadProfileFromMemoryCard( PlayerNumber pn, bool bLoadNamesOnly ); + void SaveAllProfiles() const; bool SaveProfile( PlayerNumber pn ) const; void UnloadProfile( PlayerNumber pn ); @@ -41,7 +42,7 @@ public: // High scores // void LoadMachineProfile(); - void SaveMachineProfile(); + void SaveMachineProfile() const; bool IsUsingProfile( PlayerNumber pn ) const { return !m_sProfileDir[pn].empty(); } bool IsUsingProfile( ProfileSlot slot ) const;