same support change or courses

This commit is contained in:
Glenn Maynard
2008-05-23 23:07:11 +00:00
parent 9fb1994b47
commit 48dbf58a67
+22 -22
View File
@@ -1477,17 +1477,17 @@ void SongManager::UpdatePreferredSort()
{ {
m_vPreferredCourseSort.clear(); m_vPreferredCourseSort.clear();
vector<RString> asLines;
RString sFile = THEME->GetPathO( "SongManager", "PreferredCourses.txt" ); RString sFile = THEME->GetPathO( "SongManager", "PreferredCourses.txt" );
RageFile file; if( !GetFileContents(sFile, asLines) )
if( !file.Open( sFile ) )
return; return;
vector<Course*> vpCourses; vector<Course*> vpCourses;
RString sLine; FOREACH( RString, asLines, s )
while( file.GetLine(sLine) )
{ {
bool bSectionDivider = sLine.find("---") != RString::npos; RString sLine = *s;
bool bSectionDivider = sLine.find("---") == 0;
if( bSectionDivider ) if( bSectionDivider )
{ {
if( !vpCourses.empty() ) if( !vpCourses.empty() )
@@ -1495,15 +1495,15 @@ void SongManager::UpdatePreferredSort()
m_vPreferredCourseSort.push_back( vpCourses ); m_vPreferredCourseSort.push_back( vpCourses );
vpCourses.clear(); vpCourses.clear();
} }
continue;
} }
else
{ Course *pCourse = FindCourse( sLine );
Course *pCourse = NULL; if( pCourse == NULL )
if( !sLine.empty() ) continue;
pCourse = FindCourse( sLine ); if( UNLOCKMAN->CourseIsLocked(pCourse) & LOCKED_SELECTABLE )
if( pCourse && !(UNLOCKMAN->CourseIsLocked(pCourse) & LOCKED_SELECTABLE) ) continue;
vpCourses.push_back( pCourse ); vpCourses.push_back( pCourse );
}
} }
if( !vpCourses.empty() ) if( !vpCourses.empty() )
@@ -1536,16 +1536,16 @@ void SongManager::UpdatePreferredSort()
} }
m_vPreferredCourseSort.push_back( vpUnlockCourses ); m_vPreferredCourseSort.push_back( vpUnlockCourses );
// prune empty groups
for( int i=m_vPreferredCourseSort.size()-1; i>=0; i-- )
if( m_vPreferredCourseSort[i].empty() )
m_vPreferredCourseSort.erase( m_vPreferredCourseSort.begin()+i );
FOREACH( CoursePointerVector, m_vPreferredCourseSort, i )
FOREACH( Course*, *i, j )
ASSERT( *j );
} }
// prune empty groups
for( int i=m_vPreferredCourseSort.size()-1; i>=0; i-- )
if( m_vPreferredCourseSort[i].empty() )
m_vPreferredCourseSort.erase( m_vPreferredCourseSort.begin()+i );
FOREACH( CoursePointerVector, m_vPreferredCourseSort, i )
FOREACH( Course*, *i, j )
ASSERT( *j );
} }
} }