Properly add songs that are missing a Medium difficulty to the Endless Course
This commit is contained in:
+6
-2
@@ -685,7 +685,7 @@ void Course::GetTrailUnsortedEndless( const vector<CourseEntry> &entries, Trail
|
||||
|
||||
if( pSong )
|
||||
{
|
||||
StepsUtil::GetAllMatching( pSong, stc, vSongAndSteps );
|
||||
StepsUtil::GetAllMatchingEndless( pSong, stc, vSongAndSteps );
|
||||
}
|
||||
else if( vSongAndSteps.empty() || !( bSameSongCriteria && bSameStepsCriteria ) )
|
||||
{
|
||||
@@ -821,7 +821,11 @@ void Course::GetTrailUnsortedEndless( const vector<CourseEntry> &entries, Trail
|
||||
}
|
||||
|
||||
trail.m_vEntries.push_back( te );
|
||||
|
||||
if( trail.m_vEntries.size() > 0 && te.dc != cd )
|
||||
{
|
||||
trail.m_vEntries.reserve( trail.m_vEntries.size() - 1 );
|
||||
trail.m_vEntries.resize( trail.m_vEntries.size() - 1 );
|
||||
}
|
||||
// LOG->Trace( "Chose: %s, %d", te.pSong->GetSongDir().c_str(), te.pSteps->GetMeter() );
|
||||
|
||||
if( IsAnEdit() && MAX_SONGS_IN_EDIT_COURSE > 0 &&
|
||||
|
||||
@@ -61,6 +61,42 @@ void StepsUtil::GetAllMatching( Song *pSong, const StepsCriteria &stc, vector<So
|
||||
out.push_back( SongAndSteps(pSong, *st) );
|
||||
}
|
||||
|
||||
void StepsUtil::GetAllMatchingEndless( Song *pSong, const StepsCriteria &stc, vector<SongAndSteps> &out )
|
||||
{
|
||||
const vector<Steps*> &vSteps = ( stc.m_st == StepsType_Invalid ? pSong->GetAllSteps() :
|
||||
pSong->GetStepsByStepsType( stc.m_st ) );
|
||||
int previousSize = out.size();
|
||||
int successful = false;
|
||||
|
||||
GetAllMatching( pSong, stc, out );
|
||||
if( out.size() != previousSize )
|
||||
{
|
||||
successful = true;
|
||||
}
|
||||
|
||||
if( !successful )
|
||||
{
|
||||
Difficulty difficulty = ( *( vSteps.begin() ) )->GetDifficulty();
|
||||
Difficulty previousDifficulty = difficulty;
|
||||
int lowestDifficultyIndex = 0;
|
||||
vector<Difficulty> difficulties;
|
||||
FOREACH_CONST( Steps*, vSteps, st )
|
||||
{
|
||||
previousDifficulty = difficulty;
|
||||
difficulty = ( *st )->GetDifficulty();
|
||||
if( ( st - vSteps.begin() ) == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( difficulty < previousDifficulty )
|
||||
{
|
||||
lowestDifficultyIndex = st - vSteps.begin();
|
||||
}
|
||||
}
|
||||
out.push_back( SongAndSteps( pSong, vSteps.at( lowestDifficultyIndex ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
bool StepsUtil::HasMatching( const SongCriteria &soc, const StepsCriteria &stc )
|
||||
{
|
||||
const RString &sGroupName = soc.m_sGroupName.empty()? GROUP_ALL:soc.m_sGroupName;
|
||||
|
||||
+8
-1
@@ -118,7 +118,7 @@ namespace StepsUtil
|
||||
* @param stc the StepsCriteria to look for.
|
||||
* @param out the SongsAndSteps that match.
|
||||
*/
|
||||
void GetAllMatching( const SongCriteria &soc, const StepsCriteria &stc, vector<SongAndSteps> &out ); // look up in SONGMAN
|
||||
void GetAllMatching( const SongCriteria &soc, const StepsCriteria &stc, vector<SongAndSteps> &out); // look up in SONGMAN
|
||||
/**
|
||||
* @brief Retrieve all of the Steps that match the criteria.
|
||||
* @param pSong the Song we're checking in.
|
||||
@@ -126,6 +126,13 @@ namespace StepsUtil
|
||||
* @param out the SongsAndSteps that match.
|
||||
*/
|
||||
void GetAllMatching( Song *pSong, const StepsCriteria &stc, vector<SongAndSteps> &out );
|
||||
/**
|
||||
* @brief Retrieve all of the Steps that match the criteria, for Endless mode only.
|
||||
* @param pSong the Song we're checking in.
|
||||
* @param stc the StepsCriteria to look for.
|
||||
* @param out the SongsAndSteps that match.
|
||||
*/
|
||||
void GetAllMatchingEndless( Song *pSong, const StepsCriteria &stc, vector<SongAndSteps> &out );
|
||||
/**
|
||||
* @brief Is there a <a class="el" href="class_steps.html">Step</a>
|
||||
* that matches the criteria?
|
||||
|
||||
Reference in New Issue
Block a user