fix "possibleDP=0 will choose Grade=Tier20, which may not have a graphic"

This commit is contained in:
Chris Danford
2004-05-02 09:57:28 +00:00
parent 9f8c8421e1
commit 5e6038c83a
2 changed files with 6 additions and 7 deletions
@@ -412,6 +412,8 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
m_soundInvalid.Load( THEME->GetPathToS("ScreenNameEntryTraditional invalid",true) );
SOUND->PlayMusic( THEME->GetPathToS("ScreenNameEntryTraditional music") );
this->SortByDrawOrder();
}
static inline int wrapn( int x, int n )
+4 -7
View File
@@ -181,18 +181,15 @@ Grade StageStats::GetGrade( PlayerNumber pn ) const
LOG->Trace( "GetGrade: Actual: %f, Possible: %f", Actual, Possible );
#define ROUNDING_ERROR 0.00001f
Grade grade = (Grade)(NUM_GRADE_TIERS-1); // lowest non-failing grade
Grade grade;
if( Possible == 0 )
return grade;
float fPercent = (Possible == 0) ? 0 : Actual / Possible;
float fPercent = Actual / Possible;
for( int g=0; g<NUM_GRADE_TIERS; g++ )
FOREACH_Grade(g)
{
if( fPercent >= PREFSMAN->m_fGradePercent[g]-ROUNDING_ERROR )
{
grade = (Grade)g;
grade = g;
break;
}
}