From dcafde00887903132099a48a2e688f66200edf4b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 25 Apr 2005 00:05:42 +0000 Subject: [PATCH] allow unloading steps from a specific profile --- stepmania/src/Song.cpp | 6 ++++-- stepmania/src/SongManager.cpp | 2 +- stepmania/src/song.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 59ceee9fe4..6f052a2118 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -1359,7 +1359,7 @@ bool Song::Matches(CString sGroup, CString sSong) const return false; } -void Song::FreeAllLoadedFromProfiles() +void Song::FreeAllLoadedFromProfile( ProfileSlot slot ) { /* RemoveSteps will remove and recreate autogen notes, which may reorder * m_vpSteps, so be careful not to skip over entries. */ @@ -1367,7 +1367,9 @@ void Song::FreeAllLoadedFromProfiles() for( int s=m_vpSteps.size()-1; s>=0; s-- ) { Steps* pSteps = m_vpSteps[s]; - if( pSteps->WasLoadedFromProfile() ) + if( !pSteps->WasLoadedFromProfile() ) + continue; + if( slot == PROFILE_SLOT_INVALID || pSteps->GetLoadedFromProfileSlot() == slot ) apToRemove.push_back( pSteps ); } diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 17486243cd..27fc4d1214 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -1219,7 +1219,7 @@ void SongManager::FreeAllLoadedFromProfiles() for( unsigned s=0; sFreeAllLoadedFromProfiles(); + pSong->FreeAllLoadedFromProfile(); } // After freeing some Steps pointers, the cache will be invalid. diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 4f9b6de4a9..578c39c297 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -215,7 +215,7 @@ public: void AddSteps( Steps* pSteps ); // we are responsible for deleting the memory pointed to by pSteps! void RemoveSteps( const Steps* pSteps ); - void FreeAllLoadedFromProfiles(); + void FreeAllLoadedFromProfile( ProfileSlot slot = PROFILE_SLOT_INVALID ); bool WasLoadedFromProfile() const { return m_LoadedFromProfile != PROFILE_SLOT_INVALID; } int GetNumStepsLoadedFromProfile( ProfileSlot slot ) const; bool IsEditAlreadyLoaded( Steps* pSteps ) const;