Don't use PROFILEMAN inside ProfileManager. At best, you're just referring to this, at worst, you're throwing away the constness.
This commit is contained in:
@@ -490,7 +490,7 @@ bool ProfileManager::DeleteLocalProfile( RString sProfileID )
|
|||||||
g_vLocalProfile.erase( i );
|
g_vLocalProfile.erase( i );
|
||||||
|
|
||||||
// Delete all references to this profileID
|
// Delete all references to this profileID
|
||||||
FOREACH_CONST( Preference<RString>*, PROFILEMAN->m_sDefaultLocalProfileID.m_v, i )
|
FOREACH_CONST( Preference<RString>*, m_sDefaultLocalProfileID.m_v, i )
|
||||||
{
|
{
|
||||||
if( (*i)->Get() == sProfileID )
|
if( (*i)->Get() == sProfileID )
|
||||||
(*i)->Set( "" );
|
(*i)->Set( "" );
|
||||||
@@ -599,16 +599,16 @@ const Profile* ProfileManager::GetProfile( ProfileSlot slot ) const
|
|||||||
//
|
//
|
||||||
void ProfileManager::IncrementToastiesCount( PlayerNumber pn )
|
void ProfileManager::IncrementToastiesCount( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
++PROFILEMAN->GetProfile(pn)->m_iNumToasties;
|
++GetProfile(pn)->m_iNumToasties;
|
||||||
++PROFILEMAN->GetMachineProfile()->m_iNumToasties;
|
++GetMachineProfile()->m_iNumToasties;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileManager::AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumRolls, int iNumMines, int iNumHands, float fCaloriesBurned )
|
void ProfileManager::AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumRolls, int iNumMines, int iNumHands, float fCaloriesBurned )
|
||||||
{
|
{
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, fCaloriesBurned );
|
GetProfile(pn)->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, fCaloriesBurned );
|
||||||
PROFILEMAN->GetMachineProfile()->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, fCaloriesBurned );
|
GetMachineProfile()->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, fCaloriesBurned );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -631,7 +631,7 @@ void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, Play
|
|||||||
// used name. If no profile last used name exists, use "EVNT".
|
// used name. If no profile last used name exists, use "EVNT".
|
||||||
if( GAMESTATE->IsEventMode() )
|
if( GAMESTATE->IsEventMode() )
|
||||||
{
|
{
|
||||||
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
Profile* pProfile = GetProfile(pn);
|
||||||
if( pProfile && !pProfile->m_sLastUsedHighScoreName.empty() )
|
if( pProfile && !pProfile->m_sLastUsedHighScoreName.empty() )
|
||||||
hs.SetName( pProfile->m_sLastUsedHighScoreName );
|
hs.SetName( pProfile->m_sLastUsedHighScoreName );
|
||||||
else
|
else
|
||||||
@@ -645,37 +645,37 @@ void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, Play
|
|||||||
//
|
//
|
||||||
// save high score
|
// save high score
|
||||||
//
|
//
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->AddStepsHighScore( pSong, pSteps, hs, iPersonalIndexOut );
|
GetProfile(pn)->AddStepsHighScore( pSong, pSteps, hs, iPersonalIndexOut );
|
||||||
|
|
||||||
if( hs.GetPercentDP() >= PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
if( hs.GetPercentDP() >= PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
||||||
{
|
{
|
||||||
// don't leave machine high scores for edits loaded from the player's card
|
// don't leave machine high scores for edits loaded from the player's card
|
||||||
if( !pSteps->IsAPlayerEdit() )
|
if( !pSteps->IsAPlayerEdit() )
|
||||||
PROFILEMAN->GetMachineProfile()->AddStepsHighScore( pSong, pSteps, hs, iMachineIndexOut );
|
GetMachineProfile()->AddStepsHighScore( pSong, pSteps, hs, iMachineIndexOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// save recent score
|
// save recent score
|
||||||
//
|
//
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->AddStepsRecentScore( pSong, pSteps, hs );
|
GetProfile(pn)->AddStepsRecentScore( pSong, pSteps, hs );
|
||||||
PROFILEMAN->GetMachineProfile()->AddStepsRecentScore( pSong, pSteps, hs );
|
GetMachineProfile()->AddStepsRecentScore( pSong, pSteps, hs );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileManager::IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps, PlayerNumber pn )
|
void ProfileManager::IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps, PlayerNumber pn )
|
||||||
{
|
{
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->IncrementStepsPlayCount( pSong, pSteps );
|
GetProfile(pn)->IncrementStepsPlayCount( pSong, pSteps );
|
||||||
PROFILEMAN->GetMachineProfile()->IncrementStepsPlayCount( pSong, pSteps );
|
GetMachineProfile()->IncrementStepsPlayCount( pSong, pSteps );
|
||||||
}
|
}
|
||||||
|
|
||||||
Grade ProfileManager::GetGradeForSteps( const Song *pSong, const Style *st, ProfileSlot slot, Difficulty dc ) const
|
Grade ProfileManager::GetGradeForSteps( const Song *pSong, const Style *st, ProfileSlot slot, Difficulty dc ) const
|
||||||
{
|
{
|
||||||
const Steps* pSteps = SongUtil::GetStepsByDifficulty( pSong, st->m_StepsType, dc );
|
const Steps* pSteps = SongUtil::GetStepsByDifficulty( pSong, st->m_StepsType, dc );
|
||||||
|
|
||||||
if( pSteps && PROFILEMAN->IsPersistentProfile(slot) )
|
if( pSteps && IsPersistentProfile(slot) )
|
||||||
return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSong, pSteps).HighGrade;
|
return GetProfile(slot)->GetStepsHighScoreList(pSong, pSteps).HighGrade;
|
||||||
return Grade_NoData;
|
return Grade_NoData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -695,7 +695,7 @@ void ProfileManager::AddCourseScore( const Course* pCourse, const Trail* pTrail,
|
|||||||
// used name. If no profile last used name exists, use "EVNT".
|
// used name. If no profile last used name exists, use "EVNT".
|
||||||
if( GAMESTATE->IsEventMode() )
|
if( GAMESTATE->IsEventMode() )
|
||||||
{
|
{
|
||||||
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
Profile* pProfile = GetProfile(pn);
|
||||||
if( pProfile && !pProfile->m_sLastUsedHighScoreName.empty() )
|
if( pProfile && !pProfile->m_sLastUsedHighScoreName.empty() )
|
||||||
hs.SetName( pProfile->m_sLastUsedHighScoreName );
|
hs.SetName( pProfile->m_sLastUsedHighScoreName );
|
||||||
else
|
else
|
||||||
@@ -710,24 +710,24 @@ void ProfileManager::AddCourseScore( const Course* pCourse, const Trail* pTrail,
|
|||||||
//
|
//
|
||||||
// save high score
|
// save high score
|
||||||
//
|
//
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->AddCourseHighScore( pCourse, pTrail, hs, iPersonalIndexOut );
|
GetProfile(pn)->AddCourseHighScore( pCourse, pTrail, hs, iPersonalIndexOut );
|
||||||
if( hs.GetPercentDP() >= PREFSMAN->m_fMinPercentageForMachineCourseHighScore )
|
if( hs.GetPercentDP() >= PREFSMAN->m_fMinPercentageForMachineCourseHighScore )
|
||||||
PROFILEMAN->GetMachineProfile()->AddCourseHighScore( pCourse, pTrail, hs, iMachineIndexOut );
|
GetMachineProfile()->AddCourseHighScore( pCourse, pTrail, hs, iMachineIndexOut );
|
||||||
|
|
||||||
//
|
//
|
||||||
// save recent score
|
// save recent score
|
||||||
//
|
//
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->AddCourseRecentScore( pCourse, pTrail, hs );
|
GetProfile(pn)->AddCourseRecentScore( pCourse, pTrail, hs );
|
||||||
PROFILEMAN->GetMachineProfile()->AddCourseRecentScore( pCourse, pTrail, hs );
|
GetMachineProfile()->AddCourseRecentScore( pCourse, pTrail, hs );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileManager::IncrementCoursePlayCount( const Course* pCourse, const Trail* pTrail, PlayerNumber pn )
|
void ProfileManager::IncrementCoursePlayCount( const Course* pCourse, const Trail* pTrail, PlayerNumber pn )
|
||||||
{
|
{
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->IncrementCoursePlayCount( pCourse, pTrail );
|
GetProfile(pn)->IncrementCoursePlayCount( pCourse, pTrail );
|
||||||
PROFILEMAN->GetMachineProfile()->IncrementCoursePlayCount( pCourse, pTrail );
|
GetMachineProfile()->IncrementCoursePlayCount( pCourse, pTrail );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -738,17 +738,17 @@ void ProfileManager::AddCategoryScore( StepsType st, RankingCategory rc, PlayerN
|
|||||||
{
|
{
|
||||||
HighScore hs = hs_;
|
HighScore hs = hs_;
|
||||||
hs.SetName( RANKING_TO_FILL_IN_MARKER[pn] );
|
hs.SetName( RANKING_TO_FILL_IN_MARKER[pn] );
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->AddCategoryHighScore( st, rc, hs, iPersonalIndexOut );
|
GetProfile(pn)->AddCategoryHighScore( st, rc, hs, iPersonalIndexOut );
|
||||||
if( hs.GetPercentDP() > PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
if( hs.GetPercentDP() > PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
||||||
PROFILEMAN->GetMachineProfile()->AddCategoryHighScore( st, rc, hs, iMachineIndexOut );
|
GetMachineProfile()->AddCategoryHighScore( st, rc, hs, iMachineIndexOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileManager::IncrementCategoryPlayCount( StepsType st, RankingCategory rc, PlayerNumber pn )
|
void ProfileManager::IncrementCategoryPlayCount( StepsType st, RankingCategory rc, PlayerNumber pn )
|
||||||
{
|
{
|
||||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
if( IsPersistentProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->IncrementCategoryPlayCount( st, rc );
|
GetProfile(pn)->IncrementCategoryPlayCount( st, rc );
|
||||||
PROFILEMAN->GetMachineProfile()->IncrementCategoryPlayCount( st, rc );
|
GetMachineProfile()->IncrementCategoryPlayCount( st, rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProfileManager::IsPersistentProfile( ProfileSlot slot ) const
|
bool ProfileManager::IsPersistentProfile( ProfileSlot slot ) const
|
||||||
|
|||||||
Reference in New Issue
Block a user