diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index 786b91c58e..3136f94999 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -9,14 +9,22 @@ #define EMPTY_NAME THEME->GetMetric ("HighScore","EmptyName") +struct HighScoreImpl +{ + +}; +REGISTER_CLASS_TRAITS( HighScoreImpl, new HighScoreImpl(*pCopy) ) + +HighScore::HighScore() +{ + m_Impl = new HighScoreImpl; + Unset(); +} + bool HighScore::operator>=( const HighScore& other ) const { /* 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? */ + * is the same. */ if( PREFSMAN->m_bPercentageScoring ) { if( fPercentDP == other.fPercentDP ) @@ -33,6 +41,29 @@ bool HighScore::operator>=( const HighScore& other ) const } } +bool HighScore::operator==( const HighScore& other ) const +{ +#define COMPARE(x) if( x!=other.x ) return false; + COMPARE( sName ); + COMPARE( grade ); + COMPARE( iScore ); + COMPARE( fPercentDP ); + COMPARE( fSurviveSeconds ); + COMPARE( sModifiers ); + COMPARE( dateTime ); + COMPARE( sPlayerGuid ); + COMPARE( sMachineGuid ); + COMPARE( iProductID ); + FOREACH_TapNoteScore( tns ) + COMPARE( iTapNoteScores[tns] ); + FOREACH_HoldNoteScore( hns ) + COMPARE( iHoldNoteScores[hns] ); + COMPARE( radarValues ); + COMPARE( fLifeRemainingSeconds ); +#undef COMPARE + return true; +} + XNode* HighScore::CreateNode() const { XNode* pNode = new XNode; diff --git a/stepmania/src/HighScore.h b/stepmania/src/HighScore.h index f8a264d5cd..fb655f91d1 100644 --- a/stepmania/src/HighScore.h +++ b/stepmania/src/HighScore.h @@ -7,9 +7,11 @@ #include "GameConstantsAndTypes.h" #include "RadarValues.h" #include "DateTime.h" +#include "RageUtil_AutoPtr.h" struct XNode; +struct HighScoreImpl; struct HighScore { CString sName; // name that shows in the machine's ranking screen @@ -27,7 +29,8 @@ struct HighScore RadarValues radarValues; float fLifeRemainingSeconds; - HighScore() { Unset(); } + HighScore(); + void Unset() { sName = ""; @@ -47,28 +50,7 @@ struct HighScore } bool operator>=( const HighScore& other ) const; - bool operator==( const HighScore& other ) const - { -#define COMPARE(x) if( x!=other.x ) return false; - COMPARE( sName ); - COMPARE( grade ); - COMPARE( iScore ); - COMPARE( fPercentDP ); - COMPARE( fSurviveSeconds ); - COMPARE( sModifiers ); - COMPARE( dateTime ); - COMPARE( sPlayerGuid ); - COMPARE( sMachineGuid ); - COMPARE( iProductID ); - FOREACH_TapNoteScore( tns ) - COMPARE( iTapNoteScores[tns] ); - FOREACH_HoldNoteScore( hns ) - COMPARE( iHoldNoteScores[hns] ); - COMPARE( radarValues ); - COMPARE( fLifeRemainingSeconds ); -#undef COMPARE - return true; - } + bool operator==( const HighScore& other ) const; float GetSurvivalSeconds() { return fSurviveSeconds + fLifeRemainingSeconds; } @@ -76,6 +58,8 @@ struct HighScore void LoadFromNode( const XNode* pNode ); CString GetDisplayName() const; +private: + HiddenPtr m_Impl; }; struct HighScoreList