Check extra carefully that courses are actually playable.

This commit is contained in:
Ben "root" Anderson
2014-01-14 21:14:56 -06:00
parent c3daaf9ae2
commit 1cca4aa309
+6 -34
View File
@@ -207,42 +207,14 @@ void Course::Init()
bool Course::IsPlayableIn( StepsType st ) const bool Course::IsPlayableIn( StepsType st ) const
{ {
// Stripped down version of GetTrailUnsorted Trail t;
FOREACH_CONST( CourseEntry, m_vEntries, e ) FOREACH_ShownCourseDifficulty( cd )
{ {
SongCriteria soc = e->songCriteria; if( GetTrailUnsorted( st, cd, t ) )
return true;
Song *pSong = e->songID.ToSong();
if( pSong )
{
soc.m_bUseSongAllowedList = true;
soc.m_vpSongAllowedList.push_back( pSong );
}
soc.m_Tutorial = SongCriteria::Tutorial_No;
soc.m_Locked = SongCriteria::Locked_Unlocked;
if( !soc.m_bUseSongAllowedList )
soc.m_iMaxStagesForSong = 1;
StepsCriteria stc = e->stepsCriteria;
stc.m_st = st;
stc.m_Locked = StepsCriteria::Locked_Unlocked;
const bool bSameSongCriteria = e != m_vEntries.begin() && (e-1)->songCriteria == soc;
const bool bSameStepsCriteria = e != m_vEntries.begin() && (e-1)->stepsCriteria == stc;
if( pSong )
{
if( StepsUtil::HasMatching(pSong, stc) )
return true;
}
else if( !(bSameSongCriteria && bSameStepsCriteria) )
{
if( StepsUtil::HasMatching(soc, stc) )
return true;
}
} }
// No valid trail for this StepsType.
return false; return false;
} }
@@ -661,7 +633,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
/* If the course difficulty never actually changed anything, then this difficulty /* If the course difficulty never actually changed anything, then this difficulty
* is equivalent to Difficulty_Medium; it doesn't exist. */ * is equivalent to Difficulty_Medium; it doesn't exist. */
return bCourseDifficultyIsSignificant; return bCourseDifficultyIsSignificant && trail.m_vEntries.size();
} }
void Course::GetTrails( vector<Trail*> &AddTo, StepsType st ) const void Course::GetTrails( vector<Trail*> &AddTo, StepsType st ) const