Integrate C++11 branch into 5_1-new
This commit is contained in:
+11
-21
@@ -2,7 +2,6 @@
|
||||
#include "StatsManager.h"
|
||||
#include "RageFileManager.h"
|
||||
#include "GameState.h"
|
||||
#include "Foreach.h"
|
||||
#include "ProfileManager.h"
|
||||
#include "Profile.h"
|
||||
#include "PrefsManager.h"
|
||||
@@ -20,7 +19,7 @@
|
||||
#include "PlayerState.h"
|
||||
#include "Player.h"
|
||||
|
||||
StatsManager* STATSMAN = NULL; // global object accessible from anywhere in the program
|
||||
StatsManager* STATSMAN = nullptr; // global object accessible from anywhere in the program
|
||||
|
||||
void AddPlayerStatsToProfile( Profile *pProfile, const StageStats &ss, PlayerNumber pn );
|
||||
XNode* MakeRecentScoreNode( const StageStats &ss, Trail *pTrail, const PlayerStageStats &pss, MultiPlayer mp );
|
||||
@@ -62,8 +61,8 @@ static StageStats AccumPlayedStageStats( const vector<StageStats>& vss )
|
||||
ssreturn.m_playMode = vss[0].m_playMode;
|
||||
}
|
||||
|
||||
FOREACH_CONST( StageStats, vss, ss )
|
||||
ssreturn.AddStats( *ss );
|
||||
for (StageStats const &ss :vss)
|
||||
ssreturn.AddStats( ss );
|
||||
|
||||
unsigned uNumSongs = ssreturn.m_vpPlayedSongs.size();
|
||||
|
||||
@@ -152,7 +151,7 @@ void AddPlayerStatsToProfile( Profile *pProfile, const StageStats &ss, PlayerNum
|
||||
|
||||
XNode* MakeRecentScoreNode( const StageStats &ss, Trail *pTrail, const PlayerStageStats &pss, MultiPlayer mp )
|
||||
{
|
||||
XNode* pNode = NULL;
|
||||
XNode* pNode = nullptr;
|
||||
if( GAMESTATE->IsCourseMode() )
|
||||
{
|
||||
pNode = new XNode( "HighScoreForACourseAndTrail" );
|
||||
@@ -253,10 +252,10 @@ void StatsManager::CommitStatsToProfiles( const StageStats *pSS )
|
||||
void StatsManager::SaveUploadFile( const StageStats *pSS )
|
||||
{
|
||||
// Save recent scores
|
||||
auto_ptr<XNode> xml( new XNode("Stats") );
|
||||
unique_ptr<XNode> xml( new XNode("Stats") );
|
||||
xml->AppendChild( "MachineGuid", PROFILEMAN->GetMachineProfile()->m_sGuid );
|
||||
|
||||
XNode *recent = NULL;
|
||||
XNode *recent = nullptr;
|
||||
if( GAMESTATE->IsCourseMode() )
|
||||
recent = xml->AppendChild( new XNode("RecentCourseScores") );
|
||||
else
|
||||
@@ -301,7 +300,7 @@ void StatsManager::SavePadmissScore( const StageStats *pSS, PlayerNumber pn )
|
||||
{
|
||||
const PlayerStageStats *playerStats = &pSS->m_player[ pn ];
|
||||
|
||||
auto_ptr<XNode> xml( new XNode("SongScore") );
|
||||
std::unique_ptr<XNode> xml( new XNode("SongScore") );
|
||||
|
||||
RString sDate = DateTime::GetNowDate().GetString();
|
||||
sDate.Replace(":","-");
|
||||
@@ -472,8 +471,8 @@ void StatsManager::UnjoinPlayer( PlayerNumber pn )
|
||||
/* A player has been unjoined. Clear his data from m_vPlayedStageStats, and
|
||||
* purge any m_vPlayedStageStats that no longer have any player data because
|
||||
* all of the players that were playing at the time have been unjoined. */
|
||||
FOREACH( StageStats, m_vPlayedStageStats, ss )
|
||||
ss->m_player[pn] = PlayerStageStats();
|
||||
for(StageStats &ss : m_vPlayedStageStats)
|
||||
ss.m_player[pn] = PlayerStageStats();
|
||||
|
||||
for( int i = 0; i < (int) m_vPlayedStageStats.size(); ++i )
|
||||
{
|
||||
@@ -580,17 +579,8 @@ public:
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
// If this player failed any stage, then their final grade is an F.
|
||||
bool bPlayerFailedOneStage = false;
|
||||
FOREACH_CONST( StageStats, STATSMAN->m_vPlayedStageStats, ss )
|
||||
{
|
||||
if( ss->m_player[p].m_bFailed )
|
||||
{
|
||||
bPlayerFailedOneStage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( bPlayerFailedOneStage )
|
||||
if (std::any_of(STATSMAN->m_vPlayedStageStats.begin(), STATSMAN->m_vPlayedStageStats.end(),
|
||||
[&](StageStats const &ss) { return ss.m_player[p].m_bFailed; }))
|
||||
continue;
|
||||
|
||||
top_grade = min( top_grade, stats.m_player[p].GetGrade() );
|
||||
|
||||
Reference in New Issue
Block a user