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) ); m_soundInvalid.Load( THEME->GetPathToS("ScreenNameEntryTraditional invalid",true) );
SOUND->PlayMusic( THEME->GetPathToS("ScreenNameEntryTraditional music") ); SOUND->PlayMusic( THEME->GetPathToS("ScreenNameEntryTraditional music") );
this->SortByDrawOrder();
} }
static inline int wrapn( int x, int n ) 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 ); LOG->Trace( "GetGrade: Actual: %f, Possible: %f", Actual, Possible );
#define ROUNDING_ERROR 0.00001f #define ROUNDING_ERROR 0.00001f
Grade grade = (Grade)(NUM_GRADE_TIERS-1); // lowest non-failing grade Grade grade;
if( Possible == 0 ) float fPercent = (Possible == 0) ? 0 : Actual / Possible;
return grade;
float fPercent = Actual / Possible; FOREACH_Grade(g)
for( int g=0; g<NUM_GRADE_TIERS; g++ )
{ {
if( fPercent >= PREFSMAN->m_fGradePercent[g]-ROUNDING_ERROR ) if( fPercent >= PREFSMAN->m_fGradePercent[g]-ROUNDING_ERROR )
{ {
grade = (Grade)g; grade = g;
break; break;
} }
} }