Added additional criteria to StepsCriteria and SongCriteria

Added new m_sSongName property to Song class
Slight refactor in Song::LoadSongFromDir() to set m_sSongName
Implemented the basics of #SONGSELECT course parameter
This commit is contained in:
Michael Votaw
2024-03-06 01:45:26 -08:00
committed by teejusb
parent 343f2de657
commit be87de401a
9 changed files with 257 additions and 37 deletions
+5 -10
View File
@@ -295,11 +295,13 @@ bool Song::LoadFromSongDir(RString sDir, bool load_autosave, ProfileSlot from_pr
bool use_cache = true;
std::vector<RString> sDirectoryParts;
split( m_sSongDir, "/", sDirectoryParts, false );
m_sSongName = sDirectoryParts[sDirectoryParts.size() - 2];
ASSERT(m_sSongName != "");
// save group name
if(from_profile == ProfileSlot_Invalid)
{
std::vector<RString> sDirectoryParts;
split( m_sSongDir, "/", sDirectoryParts, false );
ASSERT( sDirectoryParts.size() >= 4 ); /* e.g. "/Songs/Slow/Taps/" */
m_sGroupName = sDirectoryParts[sDirectoryParts.size()-3]; // second from last item
ASSERT( m_sGroupName != "" );
@@ -1956,15 +1958,8 @@ bool Song::Matches(RString sGroup, RString sSong) const
if( sGroup.size() && sGroup.CompareNoCase(this->m_sGroupName) != 0)
return false;
RString sDir = this->GetSongDir();
sDir.Replace("\\","/");
std::vector<RString> bits;
split( sDir, "/", bits );
ASSERT(bits.size() >= 2); // should always have at least two parts
const RString &sLastBit = bits[bits.size()-1];
// match on song dir or title (ala DWI)
if( !sSong.CompareNoCase(sLastBit) )
if( !sSong.CompareNoCase(m_sSongName) )
return true;
if( !sSong.CompareNoCase(this->GetTranslitFullTitle()) )
return true;