diff --git a/src/ChartScores.cpp b/src/ChartScores.cpp index 15666d4452..5071acbb5d 100644 --- a/src/ChartScores.cpp +++ b/src/ChartScores.cpp @@ -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); } diff --git a/src/ChartScores.h b/src/ChartScores.h index f7aefa4970..fe9866d360 100644 --- a/src/ChartScores.h +++ b/src/ChartScores.h @@ -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); diff --git a/src/HighScore.cpp b/src/HighScore.cpp index 031936e2b2..5de330a0a4 100644 --- a/src/HighScore.cpp +++ b/src/HighScore.cpp @@ -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 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 DEFINE_METHOD( GetChordCohesion, GetChordCohesion() ) DEFINE_METHOD( GetEtternaValid , GetEtternaValid() ) DEFINE_METHOD( HasReplayData, HasReplayData() ) - DEFINE_METHOD( GetChartKey, GetHistoricChartKey()) + DEFINE_METHOD( GetChartKey, GetChartKey()) LunaHighScore() { ADD_METHOD( GetName ); diff --git a/src/HighScore.h b/src/HighScore.h index 1d50f037ab..da435bc635 100644 --- a/src/HighScore.h +++ b/src/HighScore.h @@ -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 ); diff --git a/src/ProfileManager.cpp b/src/ProfileManager.cpp index 382ae1613c..bd5b5b5bad 100644 --- a/src/ProfileManager.cpp +++ b/src/ProfileManager.cpp @@ -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(); diff --git a/src/StageStats.cpp b/src/StageStats.cpp index 5b1047908f..66ad015f7c 100644 --- a/src/StageStats.cpp +++ b/src/StageStats.cpp @@ -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() );