fix MAX_EDITS_PER_PROFILE

This commit is contained in:
Glenn Maynard
2005-04-25 02:27:17 +00:00
parent 0af0e63fc8
commit d586994bf4
2 changed files with 23 additions and 2 deletions
+22 -2
View File
@@ -1185,9 +1185,10 @@ void SongManager::LoadAllFromProfileDir( const CString &sDir, ProfileSlot slot )
CStringArray asEditsFilesWithPath;
GetDirListing( sEditsDir+"*.edit", asEditsFilesWithPath, false, true );
unsigned size = min( asEditsFilesWithPath.size(), (unsigned)MAX_EDITS_PER_PROFILE );
int iNumEditsLoaded = GetNumEditsLoadedFromProfile( slot );
int size = min( (int) asEditsFilesWithPath.size(), MAX_EDITS_PER_PROFILE - iNumEditsLoaded );
for( unsigned i=0; i<size; i++ )
for( int i=0; i<size; i++ )
{
CString fn = asEditsFilesWithPath[i];
@@ -1202,6 +1203,25 @@ void SongManager::LoadAllFromProfileDir( const CString &sDir, ProfileSlot slot )
}
}
int SongManager::GetNumEditsLoadedFromProfile( ProfileSlot slot ) const
{
int iCount = 0;
for( unsigned s=0; s<m_pSongs.size(); s++ )
{
const Song *pSong = m_pSongs[s];
vector<Steps*> apSteps;
pSong->GetSteps( apSteps );
for( unsigned i = 0; i < apSteps.size(); ++i )
{
const Steps *pSteps = apSteps[i];
if( pSteps->WasLoadedFromProfile() && pSteps->GetLoadedFromProfileSlot() == slot )
++iCount;
}
}
return iCount;
}
void SongManager::FreeAllLoadedFromProfile( ProfileSlot slot )
{
for( unsigned s=0; s<m_pSongs.size(); s++ )
+1
View File
@@ -105,6 +105,7 @@ protected:
Song*& pSongOut, Steps*& pStepsOut, PlayerOptions& po_out, SongOptions& so_out );
void SanityCheckGroupDir( CString sDir ) const;
void AddGroup( CString sDir, CString sGroupDirName );
int GetNumEditsLoadedFromProfile( ProfileSlot slot ) const;
Song *FindSong( CString sGroup, CString sSong );