Skip to content

Commit

Permalink
rename highscore historicchartkey to just chartkey, as it longer make…
Browse files Browse the repository at this point in the history
…s sense to use the former under the new save structure
  • Loading branch information
MinaciousGrace committed May 3, 2017
1 parent 7b274ec commit 4eaa892
Showing 6 changed files with 20 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/ChartScores.cpp
Original file line number Diff line number Diff line change
@@ -91,7 +91,9 @@ HighScore* PlayerScores::GetChartPBUpTo(string& ck, float& rate) {
void PlayerScores::LoadScoreFromNode(RString& ck, float& rate, const XNode* hs) {
HighScore tmp;
tmp.LoadFromEttNode(hs);
tmp.SetHistoricChartKey(ck);

// this only makes sense if converting from the old save structure where the key is not known -mina
tmp.SetChartKey(ck);
pscores[ck].AddScore(tmp);
}

2 changes: 1 addition & 1 deletion src/ChartScores.h
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ class PlayerScores
Grade GetBestGradeFor(string& ck) { if (pscores.count(ck)) return pscores[ck].bestGrade; return Grade_Invalid; }

// for scores achieved during this session
void AddScore(const HighScore& hs_) { HighScore hs = hs_; pscores[hs.GetHistoricChartKey()].AddScore(hs); }
void AddScore(const HighScore& hs_) { HighScore hs = hs_; pscores[hs.GetChartKey()].AddScore(hs); }


void LoadScoreFromNode(RString& ck, float& rate, const XNode* hs);
21 changes: 12 additions & 9 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ struct HighScoreImpl

/* a half-misnomer now- since all scores are keyed by the chart key this should never change/be different,
but its historical correctness is still correct, though it should prolly be renamed tbh -mina*/
RString sHistoricChartKey;
RString ChartKey;

RString ScoreKey;
float SSRCalcVersion;
@@ -209,7 +209,7 @@ vector<int> HighScoreImpl::NoteRowsToVector(RString s) {
HighScoreImpl::HighScoreImpl()
{
sName = "";
sHistoricChartKey = "";
ChartKey = "";
ScoreKey = "";
SSRCalcVersion = 0.f;
grade = Grade_NoData;
@@ -248,7 +248,7 @@ XNode *HighScoreImpl::CreateNode() const

// TRICKY: Don't write "name to fill in" markers.
pNode->AppendChild( "Name", IsRankingToFillIn(sName) ? RString("") : sName );
pNode->AppendChild( "HistoricChartKey", sHistoricChartKey);
pNode->AppendChild( "HistoricChartKey", ChartKey);
pNode->AppendChild( "ScoreKey", ScoreKey);
pNode->AppendChild( "SSRCalcVersion", SSRCalcVersion);
pNode->AppendChild( "Grade", GradeToString(grade) );
@@ -302,7 +302,7 @@ XNode *HighScoreImpl::CreateNode() const
XNode *HighScoreImpl::CreateEttNode() const
{
XNode *pNode = new XNode("HighScore");
pNode->AppendChild("HistoricChartKey", sHistoricChartKey);
pNode->AppendChild("ChartKey", ChartKey);
pNode->AppendChild("ScoreKey", ScoreKey);
pNode->AppendChild("SSRCalcVersion", SSRCalcVersion);
pNode->AppendChild("Grade", GradeToString(GetWifeGrade()));
@@ -352,7 +352,10 @@ void HighScoreImpl::LoadFromEttNode(const XNode *pNode)

RString s;

pNode->GetChildValue("HistoricChartKey", sHistoricChartKey);
pNode->GetChildValue("ChartKey", ChartKey);
if (ChartKey == "")
pNode->GetChildValue("HistoricChartKey", ChartKey);

pNode->GetChildValue("SSRCalcVersion", SSRCalcVersion);
pNode->GetChildValue("Grade", s);
grade = StringToGrade(s);
@@ -416,7 +419,7 @@ void HighScoreImpl::LoadFromNode(const XNode *pNode)
RString s;

pNode->GetChildValue("Name", sName);
pNode->GetChildValue("HistoricChartKey", sHistoricChartKey);
pNode->GetChildValue("HistoricChartKey", ChartKey);
pNode->GetChildValue("SSRCalcVersion", SSRCalcVersion);
pNode->GetChildValue("Grade", s);
grade = StringToGrade(s);
@@ -615,7 +618,7 @@ bool HighScore::IsEmpty() const
}

RString HighScore::GetName() const { return m_Impl->sName; }
RString HighScore::GetHistoricChartKey() const { return m_Impl->sHistoricChartKey; }
RString 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; }
@@ -648,7 +651,7 @@ float HighScore::GetLifeRemainingSeconds() const { return m_Impl->fLifeRemaining
bool HighScore::GetDisqualified() const { return m_Impl->bDisqualified; }

void HighScore::SetName( const RString &sName ) { m_Impl->sName = sName; }
void HighScore::SetHistoricChartKey( RString &ck) { m_Impl->sHistoricChartKey = ck; }
void HighScore::SetChartKey( RString &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; }
@@ -1159,7 +1162,7 @@ class LunaHighScore: public Luna<HighScore>
DEFINE_METHOD( GetChordCohesion, GetChordCohesion() )
DEFINE_METHOD( GetEtternaValid , GetEtternaValid() )
DEFINE_METHOD( HasReplayData, HasReplayData() )
DEFINE_METHOD( GetChartKey, GetHistoricChartKey())
DEFINE_METHOD( GetChartKey, GetChartKey())
LunaHighScore()
{
ADD_METHOD( GetName );
4 changes: 2 additions & 2 deletions src/HighScore.h
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ struct HighScore
* @brief Retrieve the name of the player that set the high score.
* @return the name of the player. */
RString GetName() const;
RString GetHistoricChartKey() const;
RString GetChartKey() const;
float GetSSRCalcVersion() const;
/**
* @brief Retrieve the grade earned from this score.
@@ -78,7 +78,7 @@ 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 SetHistoricChartKey( RString &ck );
void SetChartKey( RString &ck );
void SetSSRCalcVersion(float cv);
void SetGrade( Grade g );
void SetScore( unsigned int iScore );
2 changes: 1 addition & 1 deletion src/ProfileManager.cpp
Original file line number Diff line number Diff line change
@@ -885,7 +885,7 @@ void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, Play
void ProfileManager::AddScoreByKey(PlayerNumber pn, const HighScore &hs_) {
HighScore hs = hs_;
Profile* pProfile = GetProfile(pn);
auto ck = hs.GetHistoricChartKey();
auto ck = hs.GetChartKey();
auto rate = hs.GetMusicRate();


2 changes: 1 addition & 1 deletion src/StageStats.cpp
Original file line number Diff line number Diff line change
@@ -141,7 +141,7 @@ static HighScore FillInHighScore(const PlayerStageStats &pss, const PlayerState
hs.SetName(sRankingToFillInMarker);

auto chartKey = GAMESTATE->m_pCurSteps[ps.m_PlayerNumber]->GetChartKey();
hs.SetHistoricChartKey(chartKey);
hs.SetChartKey(chartKey);
hs.SetGrade( pss.GetGrade() );
hs.SetScore( pss.m_iScore );
hs.SetPercentDP( pss.GetPercentDancePoints() );

0 comments on commit 4eaa892

Please sign in to comment.