diff --git a/src/SongUtil.cpp b/src/SongUtil.cpp index 6ea6b413c8..30d9c56629 100644 --- a/src/SongUtil.cpp +++ b/src/SongUtil.cpp @@ -460,10 +460,6 @@ static bool CompAscending( const pair &a, const pair &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 &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; iGetCurrentStyle()->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 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 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;