cleanup
Don't use GetSteps with the really long parameter list absolutely necessary.
This commit is contained in:
@@ -64,14 +64,12 @@ MusicBannerWheel::MusicBannerWheel()
|
||||
if ( !PREFSMAN->m_bAutogenSteps )
|
||||
{
|
||||
LOG->Trace( "Removing all autogen songs from wheel." );
|
||||
vector <Steps *> songSteps;
|
||||
vector <Song *> pNotAutogen;
|
||||
for ( unsigned i = 0; i < arraySongs.size(); i++)
|
||||
{
|
||||
//ONLY get non-autogenned steps
|
||||
songSteps.clear();
|
||||
arraySongs[i]->GetSteps( songSteps, GAMESTATE->GetCurrentStyle()->m_StepsType, DIFFICULTY_INVALID, -1, -1, "", false);
|
||||
if ( !songSteps.empty() )
|
||||
Steps* pSteps = arraySongs[i]->GetStepsByDifficulty( GAMESTATE->GetCurrentStyle()->m_StepsType, DIFFICULTY_INVALID, false );
|
||||
if ( pSteps != NULL )
|
||||
pNotAutogen.push_back( arraySongs[i] );
|
||||
}
|
||||
arraySongs.clear();
|
||||
|
||||
@@ -381,10 +381,8 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, SortOrder so, CString sP
|
||||
if( so!=SORT_ROULETTE && UNLOCKMAN->SongIsLocked(pSong) )
|
||||
continue;
|
||||
|
||||
vector<Steps*> arraySteps;
|
||||
pSong->GetSteps( arraySteps, GAMESTATE->GetCurrentStyle()->m_StepsType, DIFFICULTY_INVALID, -1, -1, "", 1 );
|
||||
|
||||
if( !arraySteps.empty() )
|
||||
// If the song has at least one steps, add it.
|
||||
if( pSong->HasStepsType(GAMESTATE->GetCurrentStyle()->m_StepsType) )
|
||||
arraySongs.push_back( pSong );
|
||||
}
|
||||
|
||||
|
||||
@@ -983,13 +983,12 @@ void BMSLoader::SlideDuplicateDifficulties( Song &p )
|
||||
* difficulties slid upwards due to (for example) having two beginner steps.
|
||||
* We do a second pass in Song::TidyUpData to eliminate any remaining duplicates
|
||||
* after this. */
|
||||
for( int i=0; i<NUM_STEPS_TYPES; i++ )
|
||||
FOREACH_StepsType( st )
|
||||
{
|
||||
StepsType st = (StepsType)i;
|
||||
|
||||
for( unsigned j=0; j<=DIFFICULTY_CHALLENGE; j++ ) // not DIFFICULTY_EDIT
|
||||
FOREACH_Difficulty( dc )
|
||||
{
|
||||
Difficulty dc = (Difficulty)j;
|
||||
if( dc == DIFFICULTY_EDIT )
|
||||
continue;
|
||||
|
||||
vector<Steps*> vSteps;
|
||||
p.GetSteps( vSteps, st, dc );
|
||||
|
||||
+37
-16
@@ -372,13 +372,12 @@ void Song::DeleteDuplicateSteps( vector<Steps*> &vSteps )
|
||||
* on this; see BMSLoader::SlideDuplicateDifficulties.) */
|
||||
void Song::AdjustDuplicateSteps()
|
||||
{
|
||||
for( int i=0; i<NUM_STEPS_TYPES; i++ )
|
||||
FOREACH_StepsType( st )
|
||||
{
|
||||
StepsType st = (StepsType)i;
|
||||
|
||||
for( unsigned j=0; j<=DIFFICULTY_CHALLENGE; j++ ) // not DIFFICULTY_EDIT
|
||||
FOREACH_Difficulty( dc )
|
||||
{
|
||||
Difficulty dc = (Difficulty)j;
|
||||
if( dc == DIFFICULTY_EDIT )
|
||||
continue;
|
||||
|
||||
vector<Steps*> vSteps;
|
||||
this->GetSteps( vSteps, st, dc );
|
||||
@@ -826,9 +825,18 @@ void Song::ReCalculateRadarValuesAndLastBeat()
|
||||
}
|
||||
}
|
||||
|
||||
void Song::GetSteps( vector<Steps*>& arrayAddTo, StepsType st, Difficulty dc, int iMeterLow, int iMeterHigh, const CString &sDescription, bool bIncludeAutoGen, int Max ) const
|
||||
void Song::GetSteps(
|
||||
vector<Steps*>& arrayAddTo,
|
||||
StepsType st,
|
||||
Difficulty dc,
|
||||
int iMeterLow,
|
||||
int iMeterHigh,
|
||||
const CString &sDescription,
|
||||
bool bIncludeAutoGen,
|
||||
int iMaxToGet
|
||||
) const
|
||||
{
|
||||
if( !Max )
|
||||
if( !iMaxToGet )
|
||||
return;
|
||||
|
||||
const vector<Steps*>& vpSteps = GetAllSteps(st);
|
||||
@@ -849,15 +857,32 @@ void Song::GetSteps( vector<Steps*>& arrayAddTo, StepsType st, Difficulty dc, in
|
||||
|
||||
arrayAddTo.push_back( pSteps );
|
||||
|
||||
if( Max != -1 )
|
||||
if( iMaxToGet != -1 )
|
||||
{
|
||||
--Max;
|
||||
if( !Max )
|
||||
--iMaxToGet;
|
||||
if( !iMaxToGet )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Steps* Song::GetSteps(
|
||||
StepsType st,
|
||||
Difficulty dc,
|
||||
int iMeterLow,
|
||||
int iMeterHigh,
|
||||
const CString &sDescription,
|
||||
bool bIncludeAutoGen
|
||||
) const
|
||||
{
|
||||
vector<Steps*> vpSteps;
|
||||
GetSteps( vpSteps, st, dc, iMeterLow, iMeterHigh, sDescription, bIncludeAutoGen, 1 ); // get max 1
|
||||
if( vpSteps.empty() )
|
||||
return NULL;
|
||||
else
|
||||
return vpSteps[0];
|
||||
}
|
||||
|
||||
Steps* Song::GetStepsByDifficulty( StepsType st, Difficulty dc, bool bIncludeAutoGen ) const
|
||||
{
|
||||
const vector<Steps*>& vpSteps = GetAllSteps(st);
|
||||
@@ -941,16 +966,12 @@ bool Song::SongCompleteForStyle( const Style *st ) const
|
||||
|
||||
bool Song::HasStepsType( StepsType st ) const
|
||||
{
|
||||
vector<Steps*> add;
|
||||
GetSteps( add, st, DIFFICULTY_INVALID, -1, -1, "", true, 1 );
|
||||
return !add.empty();
|
||||
return GetSteps( st ) != NULL;
|
||||
}
|
||||
|
||||
bool Song::HasStepsTypeAndDifficulty( StepsType st, Difficulty dc ) const
|
||||
{
|
||||
vector<Steps*> add;
|
||||
GetSteps( add, st, dc, -1, -1, "", true, 1 );
|
||||
return !add.empty();
|
||||
return GetSteps( st, dc ) != NULL;
|
||||
}
|
||||
|
||||
void Song::Save()
|
||||
|
||||
@@ -1206,7 +1206,7 @@ void SongManager::LoadAllFromProfiles()
|
||||
continue;
|
||||
}
|
||||
|
||||
SMLoader::LoadEdit( fn, (ProfileSlot) s );
|
||||
SMLoader::LoadEdit( fn, s );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,16 +154,17 @@ Steps *StepsID::ToSteps( const Song *p, bool bAllowNull, bool bUseCache ) const
|
||||
return it->second;
|
||||
}
|
||||
|
||||
vector<Steps*> vNotes;
|
||||
if( dc == DIFFICULTY_EDIT )
|
||||
p->GetSteps( vNotes, st, dc, -1, -1, sDescription, true, 1 );
|
||||
else
|
||||
p->GetSteps( vNotes, st, dc, -1, -1, "", true, 1 );
|
||||
|
||||
Steps *ret = NULL;
|
||||
if( !vNotes.empty() )
|
||||
ret = vNotes[0];
|
||||
else if( !bAllowNull )
|
||||
if( dc == DIFFICULTY_EDIT )
|
||||
{
|
||||
ret = p->GetSteps( st, dc, -1, -1, sDescription, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = p->GetSteps( st, dc, -1, -1, "", true );
|
||||
}
|
||||
|
||||
if( !bAllowNull )
|
||||
RageException::Throw( "%i, %i, \"%s\"", st, dc, sDescription.c_str() );
|
||||
|
||||
if( bUseCache )
|
||||
|
||||
+18
-1
@@ -173,7 +173,24 @@ public:
|
||||
bool HasStepsType( StepsType st ) const;
|
||||
bool HasStepsTypeAndDifficulty( StepsType st, Difficulty dc ) const;
|
||||
const vector<Steps*>& GetAllSteps( StepsType st=STEPS_TYPE_INVALID ) const { return st==STEPS_TYPE_INVALID? m_vpSteps:m_vpStepsByType[st]; }
|
||||
void GetSteps( vector<Steps*>& arrayAddTo, StepsType st = STEPS_TYPE_INVALID, Difficulty dc = DIFFICULTY_INVALID, int iMeterLow = -1, int iMeterHigh = -1, const CString &sDescription = "", bool bIncludeAutoGen = true, int Max = -1 ) const;
|
||||
void GetSteps(
|
||||
vector<Steps*>& arrayAddTo,
|
||||
StepsType st = STEPS_TYPE_INVALID,
|
||||
Difficulty dc = DIFFICULTY_INVALID,
|
||||
int iMeterLow = -1,
|
||||
int iMeterHigh = -1,
|
||||
const CString &sDescription = "",
|
||||
bool bIncludeAutoGen = true,
|
||||
int iMaxToGet = -1
|
||||
) const;
|
||||
Steps* GetSteps(
|
||||
StepsType st = STEPS_TYPE_INVALID,
|
||||
Difficulty dc = DIFFICULTY_INVALID,
|
||||
int iMeterLow = -1,
|
||||
int iMeterHigh = -1,
|
||||
const CString &sDescription = "",
|
||||
bool bIncludeAutoGen = true
|
||||
) const;
|
||||
Steps* GetStepsByDifficulty( StepsType st, Difficulty dc, bool bIncludeAutoGen = true ) const;
|
||||
Steps* GetStepsByMeter( StepsType st, int iMeterLow, int iMeterHigh ) const;
|
||||
Steps* GetStepsByDescription( StepsType st, CString sDescription ) const;
|
||||
|
||||
Reference in New Issue
Block a user