Add operator== and operator!= as well as getting all matching steps for a particular song.
This commit is contained in:
@@ -35,6 +35,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Matches( const Song *p ) const;
|
bool Matches( const Song *p ) const;
|
||||||
|
bool operator==( const SongCriteria &other ) const
|
||||||
|
{
|
||||||
|
#define X(x) (x == other.x)
|
||||||
|
return X(m_sGroupName) && X(m_bUseSongGenreAllowedList) && X(m_vsSongGenreAllowedList) &&
|
||||||
|
X(m_Selectable) && X(m_bUseSongAllowedList) && X(m_vpSongAllowedList) &&
|
||||||
|
X(m_iStagesForSong) && X(m_Tutorial) && X(m_Locked);
|
||||||
|
#undef X
|
||||||
|
}
|
||||||
|
bool operator!=( const SongCriteria &other ) const { return !operator==( other ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace SongUtil
|
namespace SongUtil
|
||||||
|
|||||||
@@ -45,14 +45,18 @@ void StepsUtil::GetAllMatching( const SongCriteria &soc, const StepsCriteria &st
|
|||||||
{
|
{
|
||||||
if( !soc.Matches(*so) )
|
if( !soc.Matches(*so) )
|
||||||
continue;
|
continue;
|
||||||
FOREACH_CONST( Steps*, (*so)->GetAllSteps(), st )
|
GetAllMatching( *so, stc, out );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StepsUtil::GetAllMatching( Song *pSong, const StepsCriteria &stc, vector<SongAndSteps> &out )
|
||||||
{
|
{
|
||||||
if( !stc.Matches(*so,*st) )
|
const vector<Steps*> &vSteps = ( stc.m_st == STEPS_TYPE_INVALID ? pSong->GetAllSteps() :
|
||||||
continue;
|
pSong->GetStepsByStepsType(stc.m_st) );
|
||||||
SongAndSteps sas = { *so, *st };
|
|
||||||
out.push_back( sas );
|
FOREACH_CONST( Steps*, vSteps, st )
|
||||||
}
|
if( stc.Matches(pSong, *st) )
|
||||||
}
|
out.push_back( SongAndSteps(pSong, *st) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Matches( const Song *pSong, const Steps *pSteps ) const;
|
bool Matches( const Song *pSong, const Steps *pSteps ) const;
|
||||||
|
bool operator==( const StepsCriteria &other ) const
|
||||||
|
{
|
||||||
|
#define X(x) (x == other.x)
|
||||||
|
return X(m_difficulty) && X(m_iLowMeter) && X(m_iHighMeter) && X(m_st) && X(m_Locked);
|
||||||
|
#undef X
|
||||||
|
}
|
||||||
|
bool operator!=( const StepsCriteria &other ) const { return !operator==( other ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class SongAndSteps
|
class SongAndSteps
|
||||||
@@ -36,6 +43,8 @@ class SongAndSteps
|
|||||||
public:
|
public:
|
||||||
Song *pSong;
|
Song *pSong;
|
||||||
Steps *pSteps;
|
Steps *pSteps;
|
||||||
|
SongAndSteps() : pSong(NULL), pSteps(NULL) { }
|
||||||
|
SongAndSteps( Song *pSong_, Steps *pSteps_ ) : pSong(pSong_), pSteps(pSteps_) { }
|
||||||
bool operator==( const SongAndSteps& other ) const { return pSong==other.pSong && pSteps==other.pSteps; }
|
bool operator==( const SongAndSteps& other ) const { return pSong==other.pSong && pSteps==other.pSteps; }
|
||||||
bool operator<( const SongAndSteps& other ) const { return pSong<=other.pSong && pSteps<=other.pSteps; }
|
bool operator<( const SongAndSteps& other ) const { return pSong<=other.pSong && pSteps<=other.pSteps; }
|
||||||
};
|
};
|
||||||
@@ -43,6 +52,7 @@ public:
|
|||||||
namespace StepsUtil
|
namespace StepsUtil
|
||||||
{
|
{
|
||||||
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
|
||||||
|
void GetAllMatching( Song *pSong, const StepsCriteria &stc, vector<SongAndSteps> &out );
|
||||||
|
|
||||||
bool CompareNotesPointersByRadarValues(const Steps* pSteps1, const Steps* pSteps2);
|
bool CompareNotesPointersByRadarValues(const Steps* pSteps1, const Steps* pSteps2);
|
||||||
bool CompareNotesPointersByMeter(const Steps *pSteps1, const Steps* pSteps2);
|
bool CompareNotesPointersByMeter(const Steps *pSteps1, const Steps* pSteps2);
|
||||||
|
|||||||
Reference in New Issue
Block a user