Split group adding off.

This commit is contained in:
Glenn Maynard
2002-09-10 07:11:29 +00:00
parent 9e857fab02
commit 0e4f2d8a54
2 changed files with 29 additions and 22 deletions
+28 -22
View File
@@ -81,6 +81,33 @@ void SongManager::SanityCheckGroupDir( CString sDir ) const
}
void SongManager::AddGroup( CString sDir, CString sGroupDirName )
{
int j;
for(j = 0; j < m_arrayGroupNames.GetSize(); ++j)
if( sGroupDirName == m_arrayGroupNames[j] ) break;
if( j != m_arrayGroupNames.GetSize() )
return; /* the group is already added */
// Look for a group banner in this group folder
CStringArray arrayGroupBanners;
GetDirListing( ssprintf("%s\\%s\\*.png", sDir, sGroupDirName), arrayGroupBanners );
GetDirListing( ssprintf("%s\\%s\\*.jpg", sDir, sGroupDirName), arrayGroupBanners );
GetDirListing( ssprintf("%s\\%s\\*.gif", sDir, sGroupDirName), arrayGroupBanners );
GetDirListing( ssprintf("%s\\%s\\*.bmp", sDir, sGroupDirName), arrayGroupBanners );
CString sBannerPath;
if( arrayGroupBanners.GetSize() > 0 )
{
sBannerPath = ssprintf("%s\\%s\\%s", sDir, sGroupDirName, arrayGroupBanners[0] );
LOG->Trace( ssprintf("Group banner for '%s' is '%s'.", sGroupDirName, sBannerPath) );
}
m_arrayGroupNames.Add( sGroupDirName );
m_GroupBannerPaths.Add(sBannerPath);
}
void SongManager::LoadStepManiaSongDir( CString sDir, void(*callback)() )
{
// trim off the trailing slash if any
@@ -100,20 +127,6 @@ void SongManager::LoadStepManiaSongDir( CString sDir, void(*callback)() )
SanityCheckGroupDir(sDir+"\\"+sGroupDirName);
// Look for a group banner in this group folder
CStringArray arrayGroupBanners;
GetDirListing( ssprintf("%s\\%s\\*.png", sDir, sGroupDirName), arrayGroupBanners );
GetDirListing( ssprintf("%s\\%s\\*.jpg", sDir, sGroupDirName), arrayGroupBanners );
GetDirListing( ssprintf("%s\\%s\\*.gif", sDir, sGroupDirName), arrayGroupBanners );
GetDirListing( ssprintf("%s\\%s\\*.bmp", sDir, sGroupDirName), arrayGroupBanners );
CString sBannerPath;
if( arrayGroupBanners.GetSize() > 0 )
{
sBannerPath = ssprintf("%s\\%s\\%s", sDir, sGroupDirName, arrayGroupBanners[0] );
LOG->Trace( ssprintf("Group banner for '%s' is '%s'.", sGroupDirName, sBannerPath) );
}
// Find all Song folders in this group directory
CStringArray arraySongDirs;
GetDirListing( ssprintf("%s\\%s\\*.*", sDir, sGroupDirName), arraySongDirs, true );
@@ -143,14 +156,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, void(*callback)() )
if(!loaded) continue;
/* Add this group to the group array. */
for(j = 0; j < m_arrayGroupNames.GetSize(); ++j)
if( sGroupDirName == m_arrayGroupNames[j] ) break;
if( j == m_arrayGroupNames.GetSize() )
{
m_arrayGroupNames.Add( sGroupDirName );
m_GroupBannerPaths.Add(sBannerPath);
}
AddGroup(sDir, sGroupDirName);
}
GAMESTATE->m_sLoadingMessage = "Done loading songs.";
+1
View File
@@ -69,6 +69,7 @@ protected:
bool GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup,
Song*& pSongOut, Notes*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out );
void SanityCheckGroupDir( CString sDir ) const;
void AddGroup( CString sDir, CString sGroupDirName );
CStringArray m_arrayGroupNames;
CStringArray m_GroupBannerPaths; // each song group has a banner associated with it