Skip to content

Commit

Permalink
also save scores to the new highscore map... clunkily
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Apr 26, 2017
1 parent 36932d1 commit cf8283b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/ProfileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,28 @@ void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, Play
*/
}

// gotta get a better way to do this, probably by making the score map a class - Mina
void ProfileManager::AddScoreByKey(PlayerNumber pn, const HighScore &hs_) {
HighScore hs = hs_;
Profile* pProfile = GetProfile(pn);
auto ck = hs.GetHistoricChartKey();
auto rate = hs.GetMusicRate();


auto &hsbk = pProfile->HighScoresByChartKey;
auto it = hsbk.find(ck);
if (it == hsbk.end()) {
vector<HighScore> hsv;
hsv.emplace_back(hs);
map<float, vector<HighScore>> hsrm;
hsrm.emplace(rate, hsv);
hsbk.emplace(ck, hsrm);
}
else {
hsbk.at(ck).at(rate).emplace_back(hs);
}
}

void ProfileManager::IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps, PlayerNumber pn )
{
if( IsPersistentProfile(pn) )
Expand Down
1 change: 1 addition & 0 deletions src/ProfileManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ProfileManager
int GetSongNumTimesPlayed( const Song* pSong, ProfileSlot card ) const;
bool IsSongNew( const Song* pSong ) const { return GetSongNumTimesPlayed(pSong,ProfileSlot_Machine)==0; }
void AddStepsScore( const Song* pSong, const Steps* pSteps , PlayerNumber pn, const HighScore &hs, int &iPersonalIndexOut, int &iMachineIndexOut );
void AddScoreByKey(PlayerNumber pn, const HighScore &hs);
void IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps, PlayerNumber pn );

// Course stats
Expand Down
1 change: 1 addition & 0 deletions src/StageStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ void StageStats::FinalizeScores( bool bSummary )
ASSERT( pSteps != NULL );

PROFILEMAN->AddStepsScore( pSong, pSteps, p, hs, m_player[p].m_iPersonalHighScoreIndex, m_player[p].m_iMachineHighScoreIndex );
PROFILEMAN->AddScoreByKey(p, hs);
}
}

Expand Down

0 comments on commit cf8283b

Please sign in to comment.