change some strings so that stats.xml doesn't use invalid entity names

This commit is contained in:
Chris Danford
2004-03-13 10:48:15 +00:00
parent 62d1a344f2
commit ada21b9787
4 changed files with 23 additions and 19 deletions
+15 -4
View File
@@ -14,6 +14,18 @@
#include "RageUtil.h"
#include "ThemeManager.h"
CString GradeToString( Grade g )
{
// string is meant to be human readable
switch( g )
{
case GRADE_NO_DATA: return "NoData";
case GRADE_FAILED: return "Failed";
default:
return ssprintf("Tier%02d",g+1);
}
}
CString GradeToThemedString( Grade g )
{
CString s = GradeToString(g);
@@ -61,10 +73,9 @@ Grade StringToGrade( const CString &sGrade )
if ( s == "FAILED" ) return GRADE_FAILED;
else if( s == "NODATA" ) return GRADE_NO_DATA;
#define MY_IS_DIGIT( c ) (c>='0'&&c<='9')
if( s.length()==2 && MY_IS_DIGIT(s[0]) && MY_IS_DIGIT(s[1]) ) // if it's a two digit number...
return (Grade)(atoi(s)-1);
int iTier;
if( sscanf(sGrade.c_str(),"TIER%02d",&iTier) == 1 ) // if it's a two digit number...
return (Grade)(iTier-1);
ASSERT(0);
return GRADE_NO_DATA;
+1 -12
View File
@@ -43,18 +43,7 @@ enum Grade
GRADE_NO_DATA, // ~GRADE_INVALID
};
inline CString GradeToString( Grade g )
{
// string is meant to be human readable
switch( g )
{
case GRADE_NO_DATA: return "NoData";
case GRADE_FAILED: return "Failed";
default:
return ssprintf("%02d",g+1);
}
}
CString GradeToString( Grade g );
CString GradeToOldString( Grade g ); // "AAA", "B", etc for backward compatibility
CString GradeToThemedString( Grade g );
Grade StringToGrade( const CString &s );
+6 -2
View File
@@ -587,7 +587,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
{
XNode* pUnlockedSongs = pGeneralDataNode->AppendChild("UnlockedSongs");
for( set<int>::const_iterator it = m_UnlockedSongs.begin(); it != m_UnlockedSongs.end(); ++it )
pUnlockedSongs->AppendChild( ssprintf("%i", *it) );
pUnlockedSongs->AppendChild( ssprintf("Unlock%i", *it) );
}
{
@@ -726,7 +726,11 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
if( pUnlockedSongs )
{
FOREACH_Node( pUnlockedSongs, song )
m_UnlockedSongs.insert( atoi(song->name) );
{
int iUnlock;
if( sscanf(song->name.c_str(),"Unlock%d",&iUnlock) == 1 )
m_UnlockedSongs.insert( iUnlock );
}
}
}
+1 -1
View File
@@ -409,7 +409,7 @@ void ScreenEvaluation::Init()
//
if( SHOW_GRADE_AREA )
{
// ugly: Touch all possible grade files to make sure they're all present
// Touch all possible grade files to make sure they're all present
for( int g=GRADE_TIER_1; g<NUM_GRADES; g++ )
THEME->GetPathToG( "ScreenEvaluation grade "+ GradeToString((Grade)g) );