fix grade sorts too
This commit is contained in:
+18
-37
@@ -460,10 +460,6 @@ static bool CompAscending( const pair<Song *, RString> &a, const pair<Song *, RS
|
||||
|
||||
void SongUtil::SortSongPointerArrayByGrades( vector<Song*> &vpSongsInOut, bool bDescending )
|
||||
{
|
||||
StepsType st;
|
||||
Difficulty dc;
|
||||
SongUtil::GetStepsTypeAndDifficultyFromSortOrder( SORT_EASY_METER, st, dc );
|
||||
|
||||
/* Optimize by pre-writing a string to compare, since doing
|
||||
* GetNumNotesWithGrade inside the sort is too slow. */
|
||||
typedef pair< Song *, RString > val;
|
||||
@@ -477,7 +473,7 @@ void SongUtil::SortSongPointerArrayByGrades( vector<Song*> &vpSongsInOut, bool b
|
||||
int iCounts[NUM_Grade];
|
||||
const Profile *pProfile = PROFILEMAN->GetMachineProfile();
|
||||
ASSERT( pProfile );
|
||||
pProfile->GetGrades( pSong, st, iCounts );
|
||||
pProfile->GetGrades( pSong, GAMESTATE->GetCurrentStyle()->m_StepsType, iCounts );
|
||||
|
||||
RString foo;
|
||||
foo.reserve(256);
|
||||
@@ -621,12 +617,8 @@ RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
|
||||
return RString();
|
||||
case SORT_TOP_GRADES:
|
||||
{
|
||||
StepsType st;
|
||||
Difficulty dc;
|
||||
SongUtil::GetStepsTypeAndDifficultyFromSortOrder( so, st, dc );
|
||||
|
||||
int iCounts[NUM_Grade];
|
||||
PROFILEMAN->GetMachineProfile()->GetGrades( pSong, st, iCounts );
|
||||
PROFILEMAN->GetMachineProfile()->GetGrades( pSong, GAMESTATE->GetCurrentStyle()->m_StepsType, iCounts );
|
||||
|
||||
for( int i=Grade_Tier01; i<NUM_Grade; ++i )
|
||||
{
|
||||
@@ -973,7 +965,6 @@ bool SongUtil::GetStepsTypeAndDifficultyFromSortOrder( SortOrder so, StepsType &
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bDoubles = false;
|
||||
switch( so )
|
||||
{
|
||||
DEFAULT_FAIL( so );
|
||||
@@ -982,37 +973,27 @@ bool SongUtil::GetStepsTypeAndDifficultyFromSortOrder( SortOrder so, StepsType &
|
||||
case SORT_MEDIUM_METER:
|
||||
case SORT_HARD_METER:
|
||||
case SORT_CHALLENGE_METER:
|
||||
bDoubles = false;
|
||||
stOut = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||
break;
|
||||
case SORT_DOUBLE_EASY_METER:
|
||||
case SORT_DOUBLE_MEDIUM_METER:
|
||||
case SORT_DOUBLE_HARD_METER:
|
||||
case SORT_DOUBLE_CHALLENGE_METER:
|
||||
bDoubles = true;
|
||||
break;
|
||||
}
|
||||
|
||||
stOut = StepsType_Invalid;
|
||||
|
||||
vector<const Style*> vpStyles;
|
||||
GAMEMAN->GetStylesForGame(GAMESTATE->m_pCurGame,vpStyles);
|
||||
FOREACH_CONST( const Style*, vpStyles, i )
|
||||
{
|
||||
if( !(*i)->m_bUsedForGameplay )
|
||||
continue;
|
||||
|
||||
if( bDoubles && (*i)->m_StyleType != StyleType_OnePlayerTwoSides )
|
||||
continue;
|
||||
if( !bDoubles && (*i)->m_StyleType != StyleType_OnePlayerOneSide && (*i)->m_StyleType != StyleType_TwoPlayersTwoSides )
|
||||
continue;
|
||||
|
||||
// Ugly hack to ignore pump's half-double.
|
||||
bool bContainsHalf = ((RString)(*i)->m_szName).find("half") != RString::npos;
|
||||
if( bContainsHalf )
|
||||
continue;
|
||||
|
||||
stOut = (*i)->m_StepsType;
|
||||
break;
|
||||
stOut = GAMESTATE->GetCurrentStyle()->m_StepsType; // in case we don't find any matches below
|
||||
vector<const Style*> vpStyles;
|
||||
GAMEMAN->GetStylesForGame(GAMESTATE->m_pCurGame,vpStyles);
|
||||
FOREACH_CONST( const Style*, vpStyles, i )
|
||||
{
|
||||
if( (*i)->m_StyleType == StyleType_OnePlayerTwoSides )
|
||||
{
|
||||
// Ugly hack to ignore pump's half-double.
|
||||
bool bContainsHalf = ((RString)(*i)->m_szName).find("half") != RString::npos;
|
||||
if( bContainsHalf )
|
||||
continue;
|
||||
stOut = (*i)->m_StepsType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user