optimize Song::GetStepsByDifficulty and Song::GetStepsByMeter
This commit is contained in:
+38
-10
@@ -903,22 +903,50 @@ void Song::GetSteps( vector<Steps*>& arrayAddTo, StepsType st, Difficulty dc, in
|
|||||||
|
|
||||||
Steps* Song::GetStepsByDifficulty( StepsType st, Difficulty dc, bool bIncludeAutoGen ) const
|
Steps* Song::GetStepsByDifficulty( StepsType st, Difficulty dc, bool bIncludeAutoGen ) const
|
||||||
{
|
{
|
||||||
vector<Steps*> vNotes;
|
/* Ignore m_bAutogenSteps for STEPS_TYPE_LIGHTS_CABINET. */
|
||||||
GetSteps( vNotes, st, dc, -1, -1, "", bIncludeAutoGen, 1 );
|
if( st != STEPS_TYPE_LIGHTS_CABINET && !PREFSMAN->m_bAutogenSteps )
|
||||||
if( vNotes.size() == 0 )
|
bIncludeAutoGen = false;
|
||||||
|
const vector<Steps*>& vpSteps = m_vpSteps;
|
||||||
|
for( unsigned i=0; i<vpSteps.size(); i++ ) // for each of the Song's Steps
|
||||||
|
{
|
||||||
|
Steps* pSteps = vpSteps[i];
|
||||||
|
|
||||||
|
if( st != STEPS_TYPE_INVALID && pSteps->m_StepsType != st )
|
||||||
|
continue;
|
||||||
|
if( dc != DIFFICULTY_INVALID && dc != pSteps->GetDifficulty() )
|
||||||
|
continue;
|
||||||
|
if( !bIncludeAutoGen && pSteps->IsAutogen() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return pSteps;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
|
||||||
return vNotes[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Steps* Song::GetStepsByMeter( StepsType st, int iMeterLow, int iMeterHigh ) const
|
Steps* Song::GetStepsByMeter( StepsType st, int iMeterLow, int iMeterHigh ) const
|
||||||
{
|
{
|
||||||
vector<Steps*> vNotes;
|
/* Ignore m_bAutogenSteps for STEPS_TYPE_LIGHTS_CABINET. */
|
||||||
GetSteps( vNotes, st, DIFFICULTY_INVALID, iMeterLow, iMeterHigh, "", true, 1 );
|
bool bIncludeAutoGen = (st == STEPS_TYPE_LIGHTS_CABINET || PREFSMAN->m_bAutogenSteps);
|
||||||
if( vNotes.size() == 0 )
|
|
||||||
|
const vector<Steps*>& vpSteps = m_vpSteps;
|
||||||
|
for( unsigned i=0; i<vpSteps.size(); i++ ) // for each of the Song's Steps
|
||||||
|
{
|
||||||
|
Steps* pSteps = vpSteps[i];
|
||||||
|
|
||||||
|
if( st != STEPS_TYPE_INVALID && pSteps->m_StepsType != st )
|
||||||
|
continue;
|
||||||
|
if( iMeterLow > pSteps->GetMeter() )
|
||||||
|
continue;
|
||||||
|
if( iMeterHigh < pSteps->GetMeter() )
|
||||||
|
continue;
|
||||||
|
if( !bIncludeAutoGen && pSteps->IsAutogen() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return pSteps;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
|
||||||
return vNotes[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Steps* Song::GetStepsByDescription( StepsType st, CString sDescription ) const
|
Steps* Song::GetStepsByDescription( StepsType st, CString sDescription ) const
|
||||||
|
|||||||
Reference in New Issue
Block a user