Skip to content

Commit

Permalink
using string instead of rstring in most of highscore
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed May 28, 2017
1 parent 15bcdba commit d76c96b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 31 deletions.
32 changes: 16 additions & 16 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,8 @@ bool HighScore::IsEmpty() const
return true;
}

RString HighScore::GetName() const { return m_Impl->sName; }
RString HighScore::GetChartKey() const { return m_Impl->ChartKey; }
string HighScore::GetName() const { return m_Impl->sName; }
string HighScore::GetChartKey() const { return m_Impl->ChartKey; }
float HighScore::GetSSRCalcVersion() const { return m_Impl->SSRCalcVersion; }
Grade HighScore::GetGrade() const { return m_Impl->grade; }
unsigned int HighScore::GetScore() const { return m_Impl->iScore; }
Expand All @@ -605,13 +605,13 @@ bool HighScore::GetChordCohesion() const {
bool HighScore::GetEtternaValid() const { return m_Impl->bEtternaValid; }
vector<float> HighScore::GetOffsetVector() const { return m_Impl->vOffsetVector; }
vector<int> HighScore::GetNoteRowVector() const { return m_Impl->vNoteRowVector; }
RString HighScore::GetScoreKey() const { return m_Impl->ScoreKey; }
string HighScore::GetScoreKey() const { return m_Impl->ScoreKey; }
float HighScore::GetSurviveSeconds() const { return m_Impl->fSurviveSeconds; }
float HighScore::GetSurvivalSeconds() const { return GetSurviveSeconds() + GetLifeRemainingSeconds(); }
RString HighScore::GetModifiers() const { return m_Impl->sModifiers; }
string HighScore::GetModifiers() const { return m_Impl->sModifiers; }
DateTime HighScore::GetDateTime() const { return m_Impl->dateTime; }
RString HighScore::GetPlayerGuid() const { return m_Impl->sPlayerGuid; }
RString HighScore::GetMachineGuid() const { return m_Impl->sMachineGuid; }
string HighScore::GetPlayerGuid() const { return m_Impl->sPlayerGuid; }
string HighScore::GetMachineGuid() const { return m_Impl->sMachineGuid; }
int HighScore::GetProductID() const { return m_Impl->iProductID; }
int HighScore::GetTapNoteScore( TapNoteScore tns ) const { return m_Impl->iTapNoteScores[tns]; }
int HighScore::GetHoldNoteScore( HoldNoteScore hns ) const { return m_Impl->iHoldNoteScores[hns]; }
Expand All @@ -620,8 +620,8 @@ const RadarValues &HighScore::GetRadarValues() const { return m_Impl->radarValue
float HighScore::GetLifeRemainingSeconds() const { return m_Impl->fLifeRemainingSeconds; }
bool HighScore::GetDisqualified() const { return m_Impl->bDisqualified; }

void HighScore::SetName( const RString &sName ) { m_Impl->sName = sName; }
void HighScore::SetChartKey( const RString &ck) { m_Impl->ChartKey = ck; }
void HighScore::SetName( const string &sName ) { m_Impl->sName = sName; }
void HighScore::SetChartKey( const string &ck) { m_Impl->ChartKey = ck; }
void HighScore::SetSSRCalcVersion(float cv) { m_Impl->SSRCalcVersion = cv; }
void HighScore::SetGrade( Grade g ) { m_Impl->grade = g; }
void HighScore::SetScore( unsigned int iScore ) { m_Impl->iScore = iScore; }
Expand All @@ -637,13 +637,13 @@ void HighScore::SetChordCohesion(bool b) { m_Impl->bNoChordCohesion = b; }
void HighScore::SetEtternaValid(bool b) { m_Impl->bEtternaValid = b; }
void HighScore::SetOffsetVector(const vector<float>& v) { m_Impl->vOffsetVector = v; }
void HighScore::SetNoteRowVector(const vector<int>& v) { m_Impl->vNoteRowVector = v; }
void HighScore::SetScoreKey(const RString& sk) { m_Impl->ScoreKey = sk; }
void HighScore::SetScoreKey(const string& sk) { m_Impl->ScoreKey = sk; }
void HighScore::SetRescoreJudgeVector(const vector<int>& v) { m_Impl->vRescoreJudgeVector = v; }
void HighScore::SetAliveSeconds( float f ) { m_Impl->fSurviveSeconds = f; }
void HighScore::SetModifiers( const RString &s ) { m_Impl->sModifiers = s; }
void HighScore::SetModifiers( const string &s ) { m_Impl->sModifiers = s; }
void HighScore::SetDateTime( DateTime d ) { m_Impl->dateTime = d; }
void HighScore::SetPlayerGuid( const RString &s ) { m_Impl->sPlayerGuid = s; }
void HighScore::SetMachineGuid( const RString &s ) { m_Impl->sMachineGuid = s; }
void HighScore::SetPlayerGuid( const string &s ) { m_Impl->sPlayerGuid = s; }
void HighScore::SetMachineGuid( const string &s ) { m_Impl->sMachineGuid = s; }
void HighScore::SetProductID( int i ) { m_Impl->iProductID = i; }
void HighScore::SetTapNoteScore( TapNoteScore tns, int i ) { m_Impl->iTapNoteScores[tns] = i; }
void HighScore::SetHoldNoteScore( HoldNoteScore hns, int i ) { m_Impl->iHoldNoteScores[hns] = i; }
Expand All @@ -659,7 +659,7 @@ void HighScore::UnloadReplayData() {
/* We normally don't give direct access to the members. We need this one
* for NameToFillIn; use a special accessor so it's easy to find where this
* is used. */
RString *HighScore::GetNameMutable() { return &m_Impl->sName; }
string *HighScore::GetNameMutable() { return &m_Impl->sName; }

bool HighScore::operator<(HighScore const& other) const
{
Expand Down Expand Up @@ -731,7 +731,7 @@ void HighScore::LoadFromEttNode(const XNode* pNode)
m_Impl->LoadFromEttNode(pNode);
}

RString HighScore::GetDisplayName() const
string HighScore::GetDisplayName() const
{
if( GetName().empty() )
return EMPTY_NAME;
Expand Down Expand Up @@ -1050,7 +1050,7 @@ float HighScore::ConvertDpToWife() {
class LunaHighScore: public Luna<HighScore>
{
public:
static int GetName( T* p, lua_State *L ) { lua_pushstring(L, p->GetName() ); return 1; }
static int GetName( T* p, lua_State *L ) { lua_pushstring(L, p->GetName().c_str()); return 1; }
static int GetScore( T* p, lua_State *L ) { lua_pushnumber(L, p->GetScore() ); return 1; }
static int GetPercentDP( T* p, lua_State *L ) { lua_pushnumber(L, p->GetPercentDP() ); return 1; }
static int GetWifeScore(T* p, lua_State *L) { lua_pushnumber(L, p->GetWifeScore()); return 1; }
Expand All @@ -1067,7 +1067,7 @@ class LunaHighScore: public Luna<HighScore>
return 1;
}
static int GetMaxCombo( T* p, lua_State *L ) { lua_pushnumber(L, p->GetMaxCombo() ); return 1; }
static int GetModifiers( T* p, lua_State *L ) { lua_pushstring(L, p->GetModifiers() ); return 1; }
static int GetModifiers( T* p, lua_State *L ) { lua_pushstring(L, p->GetModifiers().c_str() ); return 1; }
static int GetTapNoteScore( T* p, lua_State *L ) { lua_pushnumber(L, p->GetTapNoteScore( Enum::Check<TapNoteScore>(L, 1) ) ); return 1; }
static int GetHoldNoteScore( T* p, lua_State *L ) { lua_pushnumber(L, p->GetHoldNoteScore( Enum::Check<HoldNoteScore>(L, 1) ) ); return 1; }
static int RescoreToWifeJudge(T* p, lua_State *L) { lua_pushnumber(L, p->RescoreToWifeJudge(IArg(1))); return 1; }
Expand Down
32 changes: 17 additions & 15 deletions src/HighScore.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class XNode;
struct RadarValues;
struct lua_State;

using std::string;

struct HighScoreImpl;
/** @brief The high score that is earned by a player.
*
Expand All @@ -21,8 +23,8 @@ struct HighScore
/**
* @brief Retrieve the name of the player that set the high score.
* @return the name of the player. */
RString GetName() const;
RString GetChartKey() const;
string GetName() const;
string GetChartKey() const;
float GetSSRCalcVersion() const;
/**
* @brief Retrieve the grade earned from this score.
Expand All @@ -48,7 +50,7 @@ struct HighScore
bool GetEtternaValid() const;
vector<float> GetOffsetVector() const;
vector<int> GetNoteRowVector() const;
RString GetScoreKey() const;
string GetScoreKey() const;
/**
* @brief Determine how many seconds the player had left in Survival mode.
* @return the number of seconds left. */
Expand All @@ -60,10 +62,10 @@ struct HighScore
/**
* @brief Get the modifiers used for this run.
* @return the modifiers. */
RString GetModifiers() const;
string GetModifiers() const;
DateTime GetDateTime() const;
RString GetPlayerGuid() const;
RString GetMachineGuid() const;
string GetPlayerGuid() const;
string GetMachineGuid() const;
int GetProductID() const;
int GetTapNoteScore( TapNoteScore tns ) const;
int GetHoldNoteScore( HoldNoteScore tns ) const;
Expand All @@ -77,8 +79,8 @@ struct HighScore
/**
* @brief Set the name of the Player that earned the score.
* @param sName the name of the Player. */
void SetName( const RString &sName );
void SetChartKey( const RString &ck );
void SetName( const string &sName );
void SetChartKey( const string &ck );
void SetSSRCalcVersion(float cv);
void SetGrade( Grade g );
void SetScore( unsigned int iScore );
Expand All @@ -91,25 +93,25 @@ struct HighScore
void SetEtternaValid(bool b);
void SetOffsetVector(const vector<float>& v);
void SetNoteRowVector(const vector<int>& v);
void SetScoreKey(const RString& ck);
void SetScoreKey(const string& ck);
void SetRescoreJudgeVector(const vector<int>& v);
void SetAliveSeconds( float f );
void SetMaxCombo( unsigned int i );
void SetStageAward( StageAward a );
void SetPeakComboAward( PeakComboAward a );
void SetModifiers( const RString &s );
void SetModifiers( const string &s );
void SetDateTime( DateTime d );
void SetPlayerGuid( const RString &s );
void SetMachineGuid( const RString &s );
void SetPlayerGuid( const string &s );
void SetMachineGuid( const string &s );
void SetProductID( int i );
void SetTapNoteScore( TapNoteScore tns, int i );
void SetHoldNoteScore( HoldNoteScore tns, int i );
void SetRadarValues( const RadarValues &rv );
void SetLifeRemainingSeconds( float f );
void SetDisqualified( bool b );

RString *GetNameMutable();
const RString *GetNameMutable() const { return const_cast<RString *> (const_cast<HighScore *>(this)->GetNameMutable()); }
string *GetNameMutable();
const string *GetNameMutable() const { return const_cast<string *> (const_cast<HighScore *>(this)->GetNameMutable()); }

void Unset();

Expand All @@ -130,7 +132,7 @@ struct HighScore
bool HasReplayData();
void UnloadReplayData();

RString GetDisplayName() const;
string GetDisplayName() const;

// Mina stuff - Mina
float RescoreToWifeJudge(int x);
Expand Down

0 comments on commit d76c96b

Please sign in to comment.