clear ranking "name to fill in" markers on save

This commit is contained in:
Chris Danford
2003-11-09 21:40:20 +00:00
parent 8e92fb0e58
commit 6366d979ce
3 changed files with 18 additions and 0 deletions
+1
View File
@@ -202,6 +202,7 @@ enum RankingCategory
#define DEFAULT_RANKING_NAME CString("")
const CString RANKING_TO_FILL_IN_MARKER[NUM_PLAYERS] = {"#P1#","#P2#"};
inline bool IsRankingToFillIn( CString sName ) { return !sName.empty() && sName[0]=='#'; }
RankingCategory AverageMeterToRankingCategory( float fAverageMeter );
+12
View File
@@ -662,6 +662,10 @@ void SongManager::SaveCategoryRankingsToFile( CString fn )
m_CategoryDatas[st][rc].vHighScores.resize(NUM_RANKING_LINES);
for( int l=0; l<NUM_RANKING_LINES; l++ )
{
// tricky: wipe out "name to fill in" markers
if( IsRankingToFillIn(m_CategoryDatas[st][rc].vHighScores[l].sName) )
m_CategoryDatas[st][rc].vHighScores[l].sName = "";
FileWrite( f, m_CategoryDatas[st][rc].vHighScores[l].sName );
FileWrite( f, m_CategoryDatas[st][rc].vHighScores[l].iScore );
}
@@ -709,6 +713,10 @@ void SongManager::SaveCourseMemCardDataToFile( CString fn, int mc )
pCourse->m_MemCardDatas[st][mc].vHighScores.resize(NUM_RANKING_LINES);
for( int l=0; l<NUM_RANKING_LINES; l++ )
{
// tricky: wipe out "name to fill in" markers
if( IsRankingToFillIn(pCourse->m_MemCardDatas[st][mc].vHighScores[l].sName) )
pCourse->m_MemCardDatas[st][mc].vHighScores[l].sName = "";
FileWrite( f, pCourse->m_MemCardDatas[st][mc].vHighScores[l].sName );
FileWrite( f, pCourse->m_MemCardDatas[st][mc].vHighScores[l].iScore );
FileWrite( f, pCourse->m_MemCardDatas[st][mc].vHighScores[l].fSurviveTime );
@@ -766,6 +774,10 @@ void SongManager::SaveStepsMemCardDataToFile( CString fn, int mc )
pNotes->m_MemCardDatas[mc].vHighScores.resize(NUM_RANKING_LINES);
for( int l=0; l<NUM_RANKING_LINES; l++ )
{
// tricky: wipe out "name to fill in" markers
if( IsRankingToFillIn(pNotes->m_MemCardDatas[mc].vHighScores[l].sName) )
pNotes->m_MemCardDatas[mc].vHighScores[l].sName = "";
FileWrite( f, pNotes->m_MemCardDatas[mc].vHighScores[l].sName );
FileWrite( f, pNotes->m_MemCardDatas[mc].vHighScores[l].grade );
FileWrite( f, pNotes->m_MemCardDatas[mc].vHighScores[l].iScore );
+5
View File
@@ -338,6 +338,11 @@ bool Steps::MemCardData::HighScore::operator>=( const Steps::MemCardData::HighSc
void Steps::MemCardData::AddHighScore( Steps::MemCardData::HighScore hs, int &iIndexOut )
{
int i;
for( i=0; i<(int)vHighScores.size(); i++ )
{
ASSERT( vHighScores[i].sName != RANKING_TO_FILL_IN_MARKER[0] );
}
for( i=0; i<(int)vHighScores.size(); i++ )
{
if( hs >= vHighScores[i] ) // tie goes to new score