working on hiding HighScore internals

This commit is contained in:
Glenn Maynard
2005-08-12 01:05:35 +00:00
parent f4caf2275f
commit 09b7bb96bc
2 changed files with 43 additions and 28 deletions
+36 -5
View File
@@ -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;
+7 -23
View File
@@ -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<HighScoreImpl> m_Impl;
};
struct HighScoreList