add SONGMAN->FindSong

This commit is contained in:
Glenn Maynard
2003-07-09 04:09:35 +00:00
parent a43296fef9
commit 361a2b58a9
5 changed files with 39 additions and 23 deletions
+3 -23
View File
@@ -79,29 +79,9 @@ void Course::SetDefaultScore()
Song *Course::FindSong(CString sGroup, CString sSong) const
{
const vector<Song*> &apSongs = SONGMAN->GetAllSongs();
// foreach song
for( unsigned i = 0; i < apSongs.size(); i++ )
{
Song* pSong = apSongs[i];
if( sGroup.size() && sGroup.CompareNoCase(pSong->m_sGroupName) != 0)
continue; /* wrong group */
CString sDir = pSong->GetSongDir();
sDir.Replace("\\","/");
CStringArray bits;
split( sDir, "/", bits );
ASSERT(bits.size() >= 2); /* should always have at least two parts */
CString sLastBit = bits[bits.size()-1];
// match on song dir or title (ala DWI)
if( sSong.CompareNoCase(sLastBit)==0 )
return pSong;
if( sSong.CompareNoCase(pSong->GetFullTranslitTitle())==0 )
return pSong;
}
Song *pSong = SONGMAN->FindSong( sGroup, sSong );
if( pSong )
return pSong;
LOG->Trace( "Course file '%s' contains a song '%s%s%s' that is not present",
m_sPath.c_str(), sGroup.c_str(), sGroup.size()? "/":"", sSong.c_str());