From db56b757f54b676ca0af2ef9064c36ebfe1b315f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 28 Jul 2003 18:23:16 +0000 Subject: [PATCH] fix not recording AAAA over AAA --- stepmania/src/Notes.cpp | 19 +++++++++++++++++-- stepmania/src/Notes.h | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/stepmania/src/Notes.cpp b/stepmania/src/Notes.cpp index d013b6a9cd..cbbfba24fd 100644 --- a/stepmania/src/Notes.cpp +++ b/stepmania/src/Notes.cpp @@ -281,6 +281,21 @@ void Notes::SetRadarValue(int r, float val) m_fRadarValues[r] = val; } +/* Make sure we treat AAAA as higher than AAA, even though the score + * is the same. + * + * XXX: Isn't it possible to beat the grade but not beat the score, since + * grading and scores are on completely different systems? Should we be + * checking for these completely separately? */ +bool Notes::MemCardScore::HigherScore( int vsScore, Grade vsGrade ) const +{ + if( vsScore > this->iScore ) + return true; + if( vsScore < this->iScore ) + return false; + return vsGrade > this->grade; +} + void Notes::AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecordOut ) { bNewRecordOut = false; @@ -288,14 +303,14 @@ void Notes::AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecord m_MemCardScores[MEMORY_CARD_MACHINE].iNumTimesPlayed++; m_MemCardScores[pn].iNumTimesPlayed++; - if( iScore > m_MemCardScores[pn].iScore ) + if( m_MemCardScores[pn].HigherScore(iScore, grade) ) { m_MemCardScores[pn].iScore = iScore; m_MemCardScores[pn].grade = grade; bNewRecordOut = true; } - if( iScore > m_MemCardScores[MEMORY_CARD_MACHINE].iScore ) + if( m_MemCardScores[MEMORY_CARD_MACHINE].HigherScore(iScore, grade) ) { m_MemCardScores[MEMORY_CARD_MACHINE].iScore = iScore; m_MemCardScores[MEMORY_CARD_MACHINE].grade = grade; diff --git a/stepmania/src/Notes.h b/stepmania/src/Notes.h index d629ffdddf..bd4440c524 100644 --- a/stepmania/src/Notes.h +++ b/stepmania/src/Notes.h @@ -58,6 +58,7 @@ public: int iNumTimesPlayed; Grade grade; int iScore; + bool HigherScore( int iScore, Grade grade ) const; } m_MemCardScores[NUM_MEMORY_CARDS]; void AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecordOut );