changed way the course ranking sort is applied - now detects on startup and theme change rather than before each music wheel
This commit is contained in:
@@ -904,7 +904,7 @@ void Course::UpdateCourseStats()
|
|||||||
LOG->Trace("Updating course stats for %s", this->m_sName.c_str() );
|
LOG->Trace("Updating course stats for %s", this->m_sName.c_str() );
|
||||||
|
|
||||||
SortOrder_AvgDifficulty = 0;
|
SortOrder_AvgDifficulty = 0;
|
||||||
SortOrder_Ranking = 2;
|
// SortOrder_Ranking = 2; // handled in SongManager::UpdateRankingCourses
|
||||||
SortOrder_TotalDifficulty = 0;
|
SortOrder_TotalDifficulty = 0;
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@@ -918,7 +918,7 @@ void Course::UpdateCourseStats()
|
|||||||
if (m_entries[ ci[i].CourseIndex ].type != Entry::fixed)
|
if (m_entries[ ci[i].CourseIndex ].type != Entry::fixed)
|
||||||
{
|
{
|
||||||
SortOrder_AvgDifficulty = 9999999; // large number
|
SortOrder_AvgDifficulty = 9999999; // large number
|
||||||
SortOrder_Ranking = 3;
|
if (SortOrder_Ranking == 2) SortOrder_Ranking++;
|
||||||
SortOrder_TotalDifficulty = 999999; // large number
|
SortOrder_TotalDifficulty = 999999; // large number
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -926,20 +926,10 @@ void Course::UpdateCourseStats()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SortOrder_AvgDifficulty = (float)SortOrder_TotalDifficulty/GetEstimatedNumStages();
|
SortOrder_AvgDifficulty = (float)SortOrder_TotalDifficulty/GetEstimatedNumStages();
|
||||||
if (GetEstimatedNumStages() > 7) SortOrder_Ranking = 3;
|
if (GetEstimatedNumStages() > 7 && SortOrder_Ranking != 1) SortOrder_Ranking = 3;
|
||||||
|
|
||||||
// HACK: this function takes a while to execute because of
|
// OPTIMIZATION: Ranking info isn't dependant on style, so
|
||||||
// the ranking portion at the end. Do so only if it is
|
// call it sparingly. Its handled on startup and when
|
||||||
// absolutely necessary.
|
// themes change..
|
||||||
if (PREFSMAN->m_iCourseSortOrder == PrefsManager::COURSE_SORT_RANK)
|
|
||||||
{
|
|
||||||
CStringArray RankingCourses;
|
|
||||||
|
|
||||||
split( THEME->GetMetric("ScreenRanking","CoursesToShow"),",", RankingCourses);
|
|
||||||
|
|
||||||
for(i = 0; i < RankingCourses.size(); i++)
|
|
||||||
if (!RankingCourses[i].CompareNoCase(this->m_sPath))
|
|
||||||
SortOrder_Ranking = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "NoteSkinManager.h"
|
#include "NoteSkinManager.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
#include "SongManager.h"
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -168,6 +169,8 @@ void ScreenAppearanceOptions::ExportOptions()
|
|||||||
{
|
{
|
||||||
THEME->SwitchTheme( sNewTheme );
|
THEME->SwitchTheme( sNewTheme );
|
||||||
ApplyGraphicOptions(); // reset graphics to apply new window title and icon
|
ApplyGraphicOptions(); // reset graphics to apply new window title and icon
|
||||||
|
|
||||||
|
SONGMAN->UpdateRankingCourses(); // update ranking courses
|
||||||
}
|
}
|
||||||
TEXTUREMAN->DoDelayedDelete(); // delete all textures that don't have references
|
TEXTUREMAN->DoDelayedDelete(); // delete all textures that don't have references
|
||||||
|
|
||||||
|
|||||||
@@ -1174,3 +1174,24 @@ void SongManager::UpdateBest()
|
|||||||
SortSongPointerArrayByMostPlayed( m_pBestSongs );
|
SortSongPointerArrayByMostPlayed( m_pBestSongs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SongManager::UpdateRankingCourses()
|
||||||
|
{
|
||||||
|
/* Updating the ranking courses data is fairly expensive
|
||||||
|
* since it involves comparing strings. Do so sparingly.
|
||||||
|
*/
|
||||||
|
CStringArray RankingCourses;
|
||||||
|
|
||||||
|
split( THEME->GetMetric("ScreenRanking","CoursesToShow"),",", RankingCourses);
|
||||||
|
|
||||||
|
for(unsigned i=0; i < m_pCourses.size(); i++)
|
||||||
|
{
|
||||||
|
if (m_pCourses[i]->GetEstimatedNumStages() > 7)
|
||||||
|
m_pCourses[i]->SortOrder_Ranking = 3;
|
||||||
|
else
|
||||||
|
m_pCourses[i]->SortOrder_Ranking = 2;
|
||||||
|
|
||||||
|
for(unsigned j = 0; j < RankingCourses.size(); j++)
|
||||||
|
if (!RankingCourses[j].CompareNoCase(m_pCourses[i]->m_sPath))
|
||||||
|
m_pCourses[i]->SortOrder_Ranking = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -108,6 +108,7 @@ public:
|
|||||||
void AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS], RankingCategory hsc[NUM_PLAYERS], int iScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
|
void AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS], RankingCategory hsc[NUM_PLAYERS], int iScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
|
||||||
void UpdateBest();
|
void UpdateBest();
|
||||||
|
|
||||||
|
void UpdateRankingCourses();
|
||||||
protected:
|
protected:
|
||||||
void LoadStepManiaSongDir( CString sDir, LoadingWindow *ld );
|
void LoadStepManiaSongDir( CString sDir, LoadingWindow *ld );
|
||||||
void LoadDWISongDir( CString sDir );
|
void LoadDWISongDir( CString sDir );
|
||||||
|
|||||||
@@ -552,6 +552,9 @@ int main(int argc, char* argv[])
|
|||||||
/* Load the unlocks into memory */
|
/* Load the unlocks into memory */
|
||||||
GAMESTATE->m_pUnlockingSys->LoadFromDATFile( UNLOCKS_PATH );
|
GAMESTATE->m_pUnlockingSys->LoadFromDATFile( UNLOCKS_PATH );
|
||||||
|
|
||||||
|
/* Initialize which courses are ranking courses here. */
|
||||||
|
SONGMAN->UpdateRankingCourses();
|
||||||
|
|
||||||
/* Run the main loop. */
|
/* Run the main loop. */
|
||||||
GameLoop();
|
GameLoop();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user