support Course group folders

This commit is contained in:
Chris Danford
2003-04-11 00:29:44 +00:00
parent 6a77bd10a3
commit 423666c845
2 changed files with 31 additions and 3 deletions
+1 -1
View File
@@ -412,7 +412,7 @@ void ScreenSelectCourse::AfterCourseChange()
if( pCourse->GetTotalSeconds(fTotalSeconds) ) if( pCourse->GetTotalSeconds(fTotalSeconds) )
m_textTime.SetText( SecondsToTime(fTotalSeconds) ); m_textTime.SetText( SecondsToTime(fTotalSeconds) );
else else
m_textTime.SetText( "??:??:??" ); m_textTime.SetText( "xx:xx:xx" ); // The numbers format doesn't have a '?'. Is there a better solution?
m_Banner.LoadFromCourse( pCourse ); m_Banner.LoadFromCourse( pCourse );
+30 -2
View File
@@ -659,17 +659,45 @@ int SongManager::GetNumStagesForSong( const Song* pSong )
void SongManager::InitCoursesFromDisk() void SongManager::InitCoursesFromDisk()
{ {
unsigned i;
// //
// Load courses from CRS files // Load courses from in Courses dir
// //
CStringArray saCourseFiles; CStringArray saCourseFiles;
GetDirListing( "Courses/*.crs", saCourseFiles, false, true ); GetDirListing( "Courses/*.crs", saCourseFiles, false, true );
for( unsigned i=0; i<saCourseFiles.size(); i++ ) for( i=0; i<saCourseFiles.size(); i++ )
{ {
Course* pCourse = new Course; Course* pCourse = new Course;
pCourse->LoadFromCRSFile( saCourseFiles[i] ); pCourse->LoadFromCRSFile( saCourseFiles[i] );
m_pCourses.push_back( pCourse ); m_pCourses.push_back( pCourse );
} }
// Find all group directories in Courses dir
CStringArray arrayGroupDirs;
GetDirListing( "Courses/*", arrayGroupDirs, true );
SortCStringArray( arrayGroupDirs );
for( i=0; i< arrayGroupDirs.size(); i++ ) // for each dir in /Courses/
{
CString sGroupDirName = arrayGroupDirs[i];
if( 0 == stricmp( sGroupDirName, "cvs" ) ) // the directory called "CVS"
continue; // ignore it
// Find all CRS files in this group directory
CStringArray arrayCoursePaths;
GetDirListing( "Courses/"+sGroupDirName + "/*.crs", arrayCoursePaths, false, true );
SortCStringArray( arrayCoursePaths );
for( unsigned j=0; j<arrayCoursePaths.size(); j++ )
{
Course* pCourse = new Course;
pCourse->LoadFromCRSFile( arrayCoursePaths[j] );
m_pCourses.push_back( pCourse );
}
}
} }
void SongManager::InitAutogenCourses() void SongManager::InitAutogenCourses()