From 13dedd66eeffa084f3f85e934ec624e44464bd8d Mon Sep 17 00:00:00 2001 From: MinaciousGrace Date: Sun, 29 Jan 2017 20:02:38 -0500 Subject: [PATCH] remove topssrsong/steps ID --- src/Profile.cpp | 58 +++++-------------------------------------------- src/Profile.h | 4 ---- 2 files changed, 5 insertions(+), 57 deletions(-) diff --git a/src/Profile.cpp b/src/Profile.cpp index 6e6262ebda..97b4a12640 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -2269,22 +2269,6 @@ float Profile::GetTopSSRValue(unsigned int rank, int skillset) { //Undefined skillset return 0.f; } -SongID Profile::GetTopSSRSongID(unsigned int rank, int skillset) { - if (rank <= 0) - rank = 1; - if (rank > static_cast(topSSRSongIds[skillset].size())) - if (CalcTopSSRs(rank, skillset) == false) { - SongID emptySongID; - return emptySongID; - } - - if (skillset >= 0 && skillset < NUM_Skillset) - return topSSRSongIds[skillset][rank - 1]; - - //Undefined skillset - SongID emptysongID; - return emptysongID; -} Song* Profile::GetTopSSRSong(unsigned int rank, int skillset) { RString ck = GetTopSSRChartkey(rank, skillset); return SONGMAN->GetSongByChartkey(ck); @@ -2293,22 +2277,6 @@ Steps* Profile::GetTopSSRSteps(unsigned int rank, int skillset) { RString ck = GetTopSSRChartkey(rank, skillset); return SONGMAN->GetStepsByChartkey(ck); } -StepsID Profile::GetTopSSRStepsID(unsigned int rank, int skillset) { - if (rank <= 0) - rank = 1; - if (rank > static_cast(topSSRStepIds[skillset].size())) - if (CalcTopSSRs(rank, skillset) == false) { - StepsID emptyStepID; - return emptyStepID; - } - - if (skillset >= 0 && skillset < NUM_Skillset) - return topSSRStepIds[skillset][rank - 1]; - - //Undefined skillset - StepsID emptyStepID; - return emptyStepID; -} RString Profile::GetTopSSRChartkey(unsigned int rank, int skillset) { if (rank <= 0) rank = 1; @@ -2370,8 +2338,6 @@ bool Profile::CalcTopSSRs(unsigned int qty, int skillset) { //vector *topSSRHighScoresPtr = &topSSRHighScores[skillset]; vector*> *topSSRHighScoreListsPtr = &topSSRHighScoreLists[skillset]; vector *topSSRHighScoreIndexsPtr = &topSSRHighScoreIndexs[skillset]; - vector *topSSRStepIdsPtr = &topSSRStepIds[skillset]; - vector *topSSRSongIdsPtr = &topSSRSongIds[skillset]; vector *topSSRChartkeysPtr = &topSSRChartkeys[skillset]; //Counter to see if we meet the required ranking size @@ -2380,12 +2346,8 @@ bool Profile::CalcTopSSRs(unsigned int qty, int skillset) { unsigned int poscounter; //Initialize vectors - StepsID emptySteps; - SongID emptySong; HighScore* emptyHighScorePtr = NULL; vector* emptyHighScoreListsPtr = NULL; - (*topSSRStepIdsPtr).clear(); - (*topSSRSongIdsPtr).clear(); (*topSSRChartkeysPtr).clear(); //(*topSSRHighScoresPtr).clear(); (*topSSRHighScoreListsPtr).clear(); @@ -2397,8 +2359,6 @@ bool Profile::CalcTopSSRs(unsigned int qty, int skillset) { for (unsigned int i = 0; i < qty; i++) { topSSRs.emplace_back(0); - (*topSSRStepIdsPtr).emplace_back(emptySteps); - (*topSSRSongIdsPtr).emplace_back(emptySong); (*topSSRChartkeysPtr).emplace_back(""); //(*topSSRHighScoresPtr).emplace_back(emptyHighScorePtr); (*topSSRHighScoreListsPtr).emplace_back(emptyHighScoreListsPtr); @@ -2455,9 +2415,7 @@ bool Profile::CalcTopSSRs(unsigned int qty, int skillset) { if (replaced) { - (*topSSRStepIdsPtr).erase((*topSSRStepIdsPtr).begin() + temp[rate - 1].pos); topSSRs.erase(topSSRs.begin() + temp[rate - 1].pos); - (*topSSRSongIdsPtr).erase((*topSSRSongIdsPtr).begin() + temp[rate - 1].pos); (*topSSRChartkeysPtr).erase((*topSSRChartkeysPtr).begin() + temp[rate - 1].pos); //(*topSSRHighScoresPtr).erase((*topSSRHighScoresPtr).begin() + temp[rate - 1].pos); (*topSSRHighScoreListsPtr).erase((*topSSRHighScoreListsPtr).begin() + temp[rate - 1].pos); @@ -2475,21 +2433,17 @@ bool Profile::CalcTopSSRs(unsigned int qty, int skillset) { temp[rate - 1].ssr = ssr; //insert in the proper place - (*topSSRStepIdsPtr).insert((*topSSRStepIdsPtr).begin() + poscounter, stepsid); - topSSRs.insert(topSSRs.begin() + poscounter, ssr); - (*topSSRSongIdsPtr).insert((*topSSRSongIdsPtr).begin() + poscounter, id); + topSSRs.emplace(topSSRs.begin() + poscounter, ssr); (*topSSRChartkeysPtr).emplace((*topSSRChartkeysPtr).begin() + poscounter, stepsid.GetKey()); //(*topSSRHighScoresPtr).insert((*topSSRHighScoresPtr).begin() + poscounter, &(hsv[i])); - (*topSSRHighScoreListsPtr).insert((*topSSRHighScoreListsPtr).begin() + poscounter, &hsv); - (*topSSRHighScoreIndexsPtr).insert((*topSSRHighScoreIndexsPtr).begin() + poscounter, i+1); + (*topSSRHighScoreListsPtr).emplace((*topSSRHighScoreListsPtr).begin() + poscounter, &hsv); + (*topSSRHighScoreIndexsPtr).emplace((*topSSRHighScoreIndexsPtr).begin() + poscounter, i+1); //erase last element to keep the same amount of elements(qty) if (!replaced) { counter++; topSSRs.pop_back(); - (*topSSRStepIdsPtr).pop_back(); - (*topSSRSongIdsPtr).pop_back(); (*topSSRChartkeysPtr).pop_back(); //(*topSSRHighScoresPtr).pop_back(); (*topSSRHighScoreListsPtr).pop_back(); @@ -2525,11 +2479,9 @@ void Profile::TopSSRsAddNewScore(HighScore *hs, StepsID stepsid, SongID songid) //Pointers to the skillset's vectors vector *topSSRHighScoreIndexsPtr = &topSSRHighScoreIndexs[skillset]; vector*> *topSSRHighScoreListsPtr = &topSSRHighScoreLists[skillset]; - vector *topSSRStepIdsPtr = &topSSRStepIds[skillset]; - vector *topSSRSongIdsPtr = &topSSRSongIds[skillset]; - + vector *topSSRChartkeyPtr = &topSSRChartkeys[skillset]; - unsigned int qty = (*topSSRSongIdsPtr).size(); + unsigned int qty = (*topSSRChartkeyPtr).size(); if (qty == 0) continue; diff --git a/src/Profile.h b/src/Profile.h index 39029fcad2..e7ead01d90 100644 --- a/src/Profile.h +++ b/src/Profile.h @@ -458,19 +458,15 @@ class Profile void TopSSRsAddNewScore(HighScore *hs, StepsID stepsid, SongID songid); float GetTopSSRMSD(unsigned int rank, int skillset); HighScore* GetTopSSRHighScore(unsigned int rank, int skillset); - SongID GetTopSSRSongID(unsigned int rank, int skillset); - StepsID GetTopSSRStepsID(unsigned int rank, int skillset); RString GetTopSSRChartkey(unsigned int rank, int skillset); float GetTopSSRValue(unsigned int rank, int skillset); Song* GetTopSSRSong(unsigned int rank, int skillset); Steps* GetTopSSRSteps(unsigned int rank, int skillset); RString GetTopSSRSongName(unsigned int rank, int skillset); //Vector array instead of a bunch of vectors - vector topSSRSongIds[NUM_Skillset]; //vector topSSRHighScores[NUM_Skillset]; vector*> topSSRHighScoreLists[NUM_Skillset]; vector topSSRHighScoreIndexs[NUM_Skillset];//we work with index+1 so 0 is undefined - vector topSSRStepIds[NUM_Skillset]; vector topSSRChartkeys[NUM_Skillset]; private: