From cab4f4d5d1cb48aa1234577f5933bde8548a3348 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 27 Aug 2014 00:04:57 -0600 Subject: [PATCH] Fixed StatsManageer::GetFinalEvalStageStats to not put them in reverse order and not have a 3 stage limit. Fixed PlayerStageStats::AddStats to not overwrite the last entry of the record with the first entry of the record being added. --- src/PlayerStageStats.cpp | 8 ++++++-- src/StatsManager.cpp | 22 ++-------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/PlayerStageStats.cpp b/src/PlayerStageStats.cpp index 38d15f88f3..c04968c1ce 100644 --- a/src/PlayerStageStats.cpp +++ b/src/PlayerStageStats.cpp @@ -115,8 +115,12 @@ void PlayerStageStats::AddStats( const PlayerStageStats& other ) m_fLifeRemainingSeconds = other.m_fLifeRemainingSeconds; // don't accumulate m_bDisqualified |= other.m_bDisqualified; - const float fOtherFirstSecond = other.m_fFirstSecond + m_fLastSecond; - const float fOtherLastSecond = other.m_fLastSecond + m_fLastSecond; + // FirstSecond is always 0, and last second is the time of the last step, + // so add 1 second between the stages so that the last element of this + // stage's record isn't overwritten by the first element of the other + // stage's record. -Kyz + const float fOtherFirstSecond = other.m_fFirstSecond + m_fLastSecond + 1.0f; + const float fOtherLastSecond = other.m_fLastSecond + m_fLastSecond + 1.0f; m_fLastSecond = fOtherLastSecond; map::const_iterator it; diff --git a/src/StatsManager.cpp b/src/StatsManager.cpp index 5128e9d7ed..846028138e 100644 --- a/src/StatsManager.cpp +++ b/src/StatsManager.cpp @@ -90,29 +90,11 @@ static StageStats AccumPlayedStageStats( const vector& vss ) void StatsManager::GetFinalEvalStageStats( StageStats& statsOut ) const { statsOut.Init(); - vector vssToCount; - - // Show stats only for the latest 3 normal songs + passed extra stages - int PassedRegularSongsLeft = 3; - for( int i = (int)m_vPlayedStageStats.size()-1; i >= 0; --i ) + for(size_t i= 0; i < m_vPlayedStageStats.size(); ++i) { - const StageStats &ss = m_vPlayedStageStats[i]; - - if( !ss.OnePassed() ) - continue; - - if( ss.m_Stage != Stage_Extra1 && ss.m_Stage != Stage_Extra2 ) - { - if( PassedRegularSongsLeft == 0 ) - break; - - --PassedRegularSongsLeft; - } - - vssToCount.push_back( ss ); + vssToCount.push_back(m_vPlayedStageStats[i]); } - statsOut = AccumPlayedStageStats( vssToCount ); }