Split group adding off.
This commit is contained in:
@@ -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)() )
|
void SongManager::LoadStepManiaSongDir( CString sDir, void(*callback)() )
|
||||||
{
|
{
|
||||||
// trim off the trailing slash if any
|
// trim off the trailing slash if any
|
||||||
@@ -100,20 +127,6 @@ void SongManager::LoadStepManiaSongDir( CString sDir, void(*callback)() )
|
|||||||
|
|
||||||
SanityCheckGroupDir(sDir+"\\"+sGroupDirName);
|
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
|
// Find all Song folders in this group directory
|
||||||
CStringArray arraySongDirs;
|
CStringArray arraySongDirs;
|
||||||
GetDirListing( ssprintf("%s\\%s\\*.*", sDir, sGroupDirName), arraySongDirs, true );
|
GetDirListing( ssprintf("%s\\%s\\*.*", sDir, sGroupDirName), arraySongDirs, true );
|
||||||
@@ -143,14 +156,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, void(*callback)() )
|
|||||||
if(!loaded) continue;
|
if(!loaded) continue;
|
||||||
|
|
||||||
/* Add this group to the group array. */
|
/* Add this group to the group array. */
|
||||||
for(j = 0; j < m_arrayGroupNames.GetSize(); ++j)
|
AddGroup(sDir, sGroupDirName);
|
||||||
if( sGroupDirName == m_arrayGroupNames[j] ) break;
|
|
||||||
|
|
||||||
if( j == m_arrayGroupNames.GetSize() )
|
|
||||||
{
|
|
||||||
m_arrayGroupNames.Add( sGroupDirName );
|
|
||||||
m_GroupBannerPaths.Add(sBannerPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GAMESTATE->m_sLoadingMessage = "Done loading songs.";
|
GAMESTATE->m_sLoadingMessage = "Done loading songs.";
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ protected:
|
|||||||
bool GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup,
|
bool GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup,
|
||||||
Song*& pSongOut, Notes*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out );
|
Song*& pSongOut, Notes*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out );
|
||||||
void SanityCheckGroupDir( CString sDir ) const;
|
void SanityCheckGroupDir( CString sDir ) const;
|
||||||
|
void AddGroup( CString sDir, CString sGroupDirName );
|
||||||
|
|
||||||
CStringArray m_arrayGroupNames;
|
CStringArray m_arrayGroupNames;
|
||||||
CStringArray m_GroupBannerPaths; // each song group has a banner associated with it
|
CStringArray m_GroupBannerPaths; // each song group has a banner associated with it
|
||||||
|
|||||||
Reference in New Issue
Block a user