only keep top 3 scores in players' stats.xml to keep the file size small
This commit is contained in:
@@ -125,7 +125,7 @@ void HighScoreList::Init()
|
|||||||
vHighScores.clear();
|
vHighScores.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighScoreList::AddHighScore( HighScore hs, int &iIndexOut )
|
void HighScoreList::AddHighScore( HighScore hs, int &iIndexOut, bool bIsMachine )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for( i=0; i<(int)vHighScores.size(); i++ )
|
for( i=0; i<(int)vHighScores.size(); i++ )
|
||||||
@@ -133,7 +133,9 @@ void HighScoreList::AddHighScore( HighScore hs, int &iIndexOut )
|
|||||||
if( hs >= vHighScores[i] )
|
if( hs >= vHighScores[i] )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const int iMaxScores = PREFSMAN->m_iMaxHighScoresPerList;
|
const int iMaxScores = bIsMachine ?
|
||||||
|
PREFSMAN->m_iMaxHighScoresPerListForMachine :
|
||||||
|
PREFSMAN->m_iMaxHighScoresPerListForPlayer;
|
||||||
if( i < iMaxScores )
|
if( i < iMaxScores )
|
||||||
{
|
{
|
||||||
vHighScores.insert( vHighScores.begin()+i, hs );
|
vHighScores.insert( vHighScores.begin()+i, hs );
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ struct HighScoreList
|
|||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
void AddHighScore( HighScore hs, int &iIndexOut );
|
void AddHighScore( HighScore hs, int &iIndexOut, bool bIsMachine );
|
||||||
|
|
||||||
const HighScore& GetTopScore() const;
|
const HighScore& GetTopScore() const;
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,8 @@ void PrefsManager::Init()
|
|||||||
m_iAttractSoundFrequency = 1;
|
m_iAttractSoundFrequency = 1;
|
||||||
m_bAllowExtraStage = true;
|
m_bAllowExtraStage = true;
|
||||||
m_bHideDefaultNoteSkin = false;
|
m_bHideDefaultNoteSkin = false;
|
||||||
m_iMaxHighScoresPerList = 10;
|
m_iMaxHighScoresPerListForMachine = 10;
|
||||||
|
m_iMaxHighScoresPerListForPlayer = 3;
|
||||||
m_fPadStickSeconds = 0;
|
m_fPadStickSeconds = 0;
|
||||||
m_bForceMipMaps = false;
|
m_bForceMipMaps = false;
|
||||||
m_bTrilinearFiltering = false;
|
m_bTrilinearFiltering = false;
|
||||||
@@ -533,7 +534,8 @@ void PrefsManager::ReadPrefsFromFile( CString sIni )
|
|||||||
ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
|
ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
|
||||||
ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
|
ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
|
||||||
ini.GetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin );
|
ini.GetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin );
|
||||||
ini.GetValue( "Options", "MaxHighScoresPerList", m_iMaxHighScoresPerList );
|
ini.GetValue( "Options", "MaxHighScoresPerListForMachine", m_iMaxHighScoresPerListForMachine );
|
||||||
|
ini.GetValue( "Options", "MaxHighScoresPerListForPlayer", m_iMaxHighScoresPerListForPlayer );
|
||||||
ini.GetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
|
ini.GetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
|
||||||
ini.GetValue( "Options", "ForceMipMaps", m_bForceMipMaps );
|
ini.GetValue( "Options", "ForceMipMaps", m_bForceMipMaps );
|
||||||
ini.GetValue( "Options", "TrilinearFiltering", m_bTrilinearFiltering );
|
ini.GetValue( "Options", "TrilinearFiltering", m_bTrilinearFiltering );
|
||||||
@@ -760,7 +762,8 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
|
|||||||
ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
|
ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
|
||||||
ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
|
ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
|
||||||
ini.SetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin );
|
ini.SetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin );
|
||||||
ini.SetValue( "Options", "MaxHighScoresPerList", m_iMaxHighScoresPerList );
|
ini.SetValue( "Options", "MaxHighScoresPerListForMachine", m_iMaxHighScoresPerListForMachine );
|
||||||
|
ini.SetValue( "Options", "MaxHighScoresPerListForPlayer", m_iMaxHighScoresPerListForPlayer );
|
||||||
ini.SetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
|
ini.SetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
|
||||||
ini.SetValue( "Options", "ForceMipMaps", m_bForceMipMaps );
|
ini.SetValue( "Options", "ForceMipMaps", m_bForceMipMaps );
|
||||||
ini.SetValue( "Options", "TrilinearFiltering", m_bTrilinearFiltering );
|
ini.SetValue( "Options", "TrilinearFiltering", m_bTrilinearFiltering );
|
||||||
|
|||||||
@@ -196,7 +196,8 @@ public:
|
|||||||
int m_iAttractSoundFrequency; // 0 = never, 1 = every time
|
int m_iAttractSoundFrequency; // 0 = never, 1 = every time
|
||||||
bool m_bAllowExtraStage;
|
bool m_bAllowExtraStage;
|
||||||
bool m_bHideDefaultNoteSkin;
|
bool m_bHideDefaultNoteSkin;
|
||||||
int m_iMaxHighScoresPerList;
|
int m_iMaxHighScoresPerListForMachine;
|
||||||
|
int m_iMaxHighScoresPerListForPlayer;
|
||||||
bool m_bCelShadeDancers;
|
bool m_bCelShadeDancers;
|
||||||
|
|
||||||
// Number of seconds it takes for a button on the controller to release
|
// Number of seconds it takes for a button on the controller to release
|
||||||
|
|||||||
+19
-15
@@ -419,7 +419,7 @@ int Profile::GetSongNumTimesPlayed( const SongID& songID ) const
|
|||||||
//
|
//
|
||||||
void Profile::AddStepsHighScore( const Song* pSong, const Steps* pSteps, HighScore hs, int &iIndexOut )
|
void Profile::AddStepsHighScore( const Song* pSong, const Steps* pSteps, HighScore hs, int &iIndexOut )
|
||||||
{
|
{
|
||||||
GetStepsHighScoreList(pSong,pSteps).AddHighScore( hs, iIndexOut );
|
GetStepsHighScoreList(pSong,pSteps).AddHighScore( hs, iIndexOut, IsMachine() );
|
||||||
}
|
}
|
||||||
|
|
||||||
const HighScoreList& Profile::GetStepsHighScoreList( const Song* pSong, const Steps* pSteps ) const
|
const HighScoreList& Profile::GetStepsHighScoreList( const Song* pSong, const Steps* pSteps ) const
|
||||||
@@ -483,7 +483,7 @@ void Profile::GetGrades( const Song* pSong, StepsType st, int iCounts[NUM_GRADES
|
|||||||
//
|
//
|
||||||
void Profile::AddCourseHighScore( const Course* pCourse, const Trail* pTrail, HighScore hs, int &iIndexOut )
|
void Profile::AddCourseHighScore( const Course* pCourse, const Trail* pTrail, HighScore hs, int &iIndexOut )
|
||||||
{
|
{
|
||||||
GetCourseHighScoreList(pCourse,pTrail).AddHighScore( hs, iIndexOut );
|
GetCourseHighScoreList(pCourse,pTrail).AddHighScore( hs, iIndexOut, IsMachine() );
|
||||||
}
|
}
|
||||||
|
|
||||||
const HighScoreList& Profile::GetCourseHighScoreList( const Course* pCourse, const Trail* pTrail ) const
|
const HighScoreList& Profile::GetCourseHighScoreList( const Course* pCourse, const Trail* pTrail ) const
|
||||||
@@ -541,7 +541,7 @@ void Profile::IncrementCoursePlayCount( const Course* pCourse, const Trail* pTra
|
|||||||
//
|
//
|
||||||
void Profile::AddCategoryHighScore( StepsType st, RankingCategory rc, HighScore hs, int &iIndexOut )
|
void Profile::AddCategoryHighScore( StepsType st, RankingCategory rc, HighScore hs, int &iIndexOut )
|
||||||
{
|
{
|
||||||
m_CategoryHighScores[st][rc].AddHighScore( hs, iIndexOut );
|
m_CategoryHighScores[st][rc].AddHighScore( hs, iIndexOut, IsMachine() );
|
||||||
}
|
}
|
||||||
|
|
||||||
const HighScoreList& Profile::GetCategoryHighScoreList( StepsType st, RankingCategory rc ) const
|
const HighScoreList& Profile::GetCategoryHighScoreList( StepsType st, RankingCategory rc ) const
|
||||||
@@ -604,13 +604,14 @@ bool Profile::LoadAllFromDir( CString sDir, bool bRequireSignature )
|
|||||||
//
|
//
|
||||||
// Don't unreasonably large stats.xml files.
|
// Don't unreasonably large stats.xml files.
|
||||||
//
|
//
|
||||||
const bool bThisIsMachineProfile = (this == PROFILEMAN->GetMachineProfile()); // XXX
|
if( !IsMachine() ) // only check stats coming from the player
|
||||||
|
|
||||||
int iBytes = FILEMAN->GetFileSizeInBytes( fn );
|
|
||||||
if( !bThisIsMachineProfile && iBytes > MAX_PLAYER_STATS_XML_SIZE_BYTES )
|
|
||||||
{
|
{
|
||||||
LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
|
int iBytes = FILEMAN->GetFileSizeInBytes( fn );
|
||||||
break;
|
if( iBytes > MAX_PLAYER_STATS_XML_SIZE_BYTES )
|
||||||
|
{
|
||||||
|
LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bRequireSignature )
|
if( bRequireSignature )
|
||||||
@@ -696,9 +697,8 @@ bool Profile::SaveAllToDir( CString sDir, bool bSignData ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool bThisIsMachineProfile = (this == PROFILEMAN->GetMachineProfile()); // XXX
|
if( (IsMachine() && PREFSMAN->m_bWriteMachineStatsHtml) ||
|
||||||
if( (bThisIsMachineProfile && PREFSMAN->m_bWriteMachineStatsHtml) ||
|
(!IsMachine() && PREFSMAN->m_bWritePlayerStatsHtml) )
|
||||||
(!bThisIsMachineProfile && PREFSMAN->m_bWritePlayerStatsHtml) )
|
|
||||||
SaveStatsWebPageToDir( sDir );
|
SaveStatsWebPageToDir( sDir );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1253,13 +1253,11 @@ void Profile::SaveStatsWebPageToDir( CString sDir ) const
|
|||||||
{
|
{
|
||||||
ASSERT( PROFILEMAN );
|
ASSERT( PROFILEMAN );
|
||||||
|
|
||||||
bool bThisIsMachineProfile = (this == PROFILEMAN->GetMachineProfile()); // UGLY
|
|
||||||
|
|
||||||
SaveStatsWebPage(
|
SaveStatsWebPage(
|
||||||
sDir,
|
sDir,
|
||||||
this,
|
this,
|
||||||
PROFILEMAN->GetMachineProfile(),
|
PROFILEMAN->GetMachineProfile(),
|
||||||
bThisIsMachineProfile ? HTML_TYPE_MACHINE : HTML_TYPE_PLAYER
|
IsMachine() ? HTML_TYPE_MACHINE : HTML_TYPE_PLAYER
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1711,3 +1709,9 @@ const Profile::HighScoresForACourse *Profile::GetHighScoresForACourse( const Cou
|
|||||||
return NULL;
|
return NULL;
|
||||||
return &it->second;
|
return &it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Profile::IsMachine() const
|
||||||
|
{
|
||||||
|
// TODO: Think of a better way to handle this
|
||||||
|
return this == PROFILEMAN->GetMachineProfile();
|
||||||
|
}
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ public:
|
|||||||
|
|
||||||
void AddStepTotals( int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands );
|
void AddStepTotals( int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands );
|
||||||
|
|
||||||
|
bool IsMachine() const;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Editable data
|
// Editable data
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ void HighScoreWheelItem::ShowFocus()
|
|||||||
|
|
||||||
void HighScoreWheel::Load( const HighScoreList& hsl, int iIndexToFocus )
|
void HighScoreWheel::Load( const HighScoreList& hsl, int iIndexToFocus )
|
||||||
{
|
{
|
||||||
m_Items.resize( PREFSMAN->m_iMaxHighScoresPerList );
|
m_Items.resize( PREFSMAN->m_iMaxHighScoresPerListForMachine );
|
||||||
for( int i=0; i<PREFSMAN->m_iMaxHighScoresPerList; i++ )
|
for( int i=0; i<PREFSMAN->m_iMaxHighScoresPerListForMachine; i++ )
|
||||||
{
|
{
|
||||||
if( unsigned(i) < hsl.vHighScores.size() )
|
if( unsigned(i) < hsl.vHighScores.size() )
|
||||||
m_Items[i].Load( i, hsl.vHighScores[i] );
|
m_Items[i].Load( i, hsl.vHighScores[i] );
|
||||||
|
|||||||
Reference in New Issue
Block a user