Restrict course editor to playable songs.
This does not yet deal with songs with charts in multiple game types. ...at least, as far as I know.
This commit is contained in:
@@ -145,7 +145,7 @@ void ScreenOptionsEditCourse::Init()
|
|||||||
sc.m_Tutorial = SongCriteria::Tutorial_No;
|
sc.m_Tutorial = SongCriteria::Tutorial_No;
|
||||||
sc.m_Locked = SongCriteria::Locked_Unlocked;
|
sc.m_Locked = SongCriteria::Locked_Unlocked;
|
||||||
|
|
||||||
SongUtil::FilterSongs( sc, SONGMAN->GetAllSongs(), m_vpSongs );
|
SongUtil::FilterSongs( sc, SONGMAN->GetAllSongs(), m_vpSongs, true );
|
||||||
|
|
||||||
SongUtil::SortSongPointerArrayByTitle( m_vpSongs );
|
SongUtil::SortSongPointerArrayByTitle( m_vpSongs );
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-2
@@ -871,13 +871,15 @@ void SongUtil::GetAllSongGenres( vector<RString> &vsOut )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongUtil::FilterSongs( const SongCriteria &sc, const vector<Song*> &in, vector<Song*> &out )
|
void SongUtil::FilterSongs( const SongCriteria &sc, const vector<Song*> &in,
|
||||||
|
vector<Song*> &out, bool doCareAboutGame )
|
||||||
{
|
{
|
||||||
out.reserve( in.size() );
|
out.reserve( in.size() );
|
||||||
FOREACH_CONST( Song*, in, s )
|
FOREACH_CONST( Song*, in, s )
|
||||||
{
|
{
|
||||||
if( sc.Matches( *s ) )
|
if( sc.Matches( *s ) && (!doCareAboutGame || IsSongPlayable(*s) ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
out.push_back( *s );
|
out.push_back( *s );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -963,6 +965,21 @@ bool SongUtil::IsStepsPlayable( Song *pSong, Steps *pSteps )
|
|||||||
return find( vpSteps.begin(), vpSteps.end(), pSteps ) != vpSteps.end();
|
return find( vpSteps.begin(), vpSteps.end(), pSteps ) != vpSteps.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SongUtil::IsSongPlayable( Song *s )
|
||||||
|
{
|
||||||
|
const vector<Steps*> & steps = s->GetAllSteps();
|
||||||
|
// I'm sure there is a foreach loop, but I don't
|
||||||
|
FOREACH( Steps*, const_cast<vector<Steps*>&>(steps), step )
|
||||||
|
{
|
||||||
|
if (IsStepsPlayable(s, *step))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool SongUtil::GetStepsTypeAndDifficultyFromSortOrder( SortOrder so, StepsType &stOut, Difficulty &dcOut )
|
bool SongUtil::GetStepsTypeAndDifficultyFromSortOrder( SortOrder so, StepsType &stOut, Difficulty &dcOut )
|
||||||
{
|
{
|
||||||
switch( so )
|
switch( so )
|
||||||
|
|||||||
+14
-1
@@ -163,13 +163,26 @@ namespace SongUtil
|
|||||||
bool ValidateCurrentStepsCredit( const RString &sAnswer, RString &sErrorOut );
|
bool ValidateCurrentStepsCredit( const RString &sAnswer, RString &sErrorOut );
|
||||||
|
|
||||||
void GetAllSongGenres( vector<RString> &vsOut );
|
void GetAllSongGenres( vector<RString> &vsOut );
|
||||||
void FilterSongs( const SongCriteria &sc, const vector<Song*> &in, vector<Song*> &out );
|
/**
|
||||||
|
* @brief Filter the selection of songs to only match certain criteria.
|
||||||
|
* @param sc the intended song criteria.
|
||||||
|
* @param in the starting batch of songs.
|
||||||
|
* @param out the resulting batch.
|
||||||
|
* @param doCareAboutGame a flag to see if we should only get playable steps. */
|
||||||
|
void FilterSongs( const SongCriteria &sc, const vector<Song*> &in, vector<Song*> &out,
|
||||||
|
bool doCareAboutGame = false );
|
||||||
|
|
||||||
void GetPlayableStepsTypes( const Song *pSong, set<StepsType> &vOut );
|
void GetPlayableStepsTypes( const Song *pSong, set<StepsType> &vOut );
|
||||||
void GetPlayableSteps( const Song *pSong, vector<Steps*> &vOut );
|
void GetPlayableSteps( const Song *pSong, vector<Steps*> &vOut );
|
||||||
bool IsStepsTypePlayable( Song *pSong, StepsType st );
|
bool IsStepsTypePlayable( Song *pSong, StepsType st );
|
||||||
bool IsStepsPlayable( Song *pSong, Steps *pSteps );
|
bool IsStepsPlayable( Song *pSong, Steps *pSteps );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Determine if the song has any playable steps in the present game.
|
||||||
|
* @param s the current song.
|
||||||
|
* @return true if the song has playable steps, false otherwise. */
|
||||||
|
bool IsSongPlayable( Song *s );
|
||||||
|
|
||||||
bool GetStepsTypeAndDifficultyFromSortOrder( SortOrder so, StepsType &st, Difficulty &dc );
|
bool GetStepsTypeAndDifficultyFromSortOrder( SortOrder so, StepsType &st, Difficulty &dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user