reduce dependencies
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "ProfileManager.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "ThemeMetric.h"
|
||||
#include "HighScore.h"
|
||||
|
||||
CString GRADE_X_NAME( size_t p ) { return ssprintf("GradeP%dX",int(p+1)); }
|
||||
CString GRADE_Y_NAME( size_t p ) { return ssprintf("GradeP%dY",int(p+1)); }
|
||||
@@ -253,13 +254,14 @@ void MusicWheelItem::RefreshGrades()
|
||||
dc = GAMESTATE->m_pCurSteps[p]->GetDifficulty();
|
||||
else
|
||||
dc = GAMESTATE->m_PreferredDifficulty[p];
|
||||
Grade grade;
|
||||
if( PROFILEMAN->IsPersistentProfile(p) )
|
||||
grade = PROFILEMAN->GetHighScoreForDifficulty( data->m_pSong, GAMESTATE->GetCurrentStyle(), (ProfileSlot)p, dc ).grade;
|
||||
else
|
||||
grade = PROFILEMAN->GetHighScoreForDifficulty( data->m_pSong, GAMESTATE->GetCurrentStyle(), PROFILE_SLOT_MACHINE, dc ).grade;
|
||||
|
||||
m_GradeDisplay[p].SetGrade( p, grade );
|
||||
HighScore hs;
|
||||
if( PROFILEMAN->IsPersistentProfile(p) )
|
||||
PROFILEMAN->GetHighScoreForDifficulty( data->m_pSong, GAMESTATE->GetCurrentStyle(), (ProfileSlot)p, dc, hs );
|
||||
else
|
||||
PROFILEMAN->GetHighScoreForDifficulty( data->m_pSong, GAMESTATE->GetCurrentStyle(), PROFILE_SLOT_MACHINE, dc, hs );
|
||||
|
||||
m_GradeDisplay[p].SetGrade( p, hs.grade );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "XmlFile.h"
|
||||
#include "StepsUtil.h"
|
||||
#include "Style.h"
|
||||
#include "HighScore.h"
|
||||
|
||||
|
||||
ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program
|
||||
@@ -82,7 +83,7 @@ void ProfileManager::GetLocalProfileNames( vector<CString> &asNamesOut ) const
|
||||
}
|
||||
|
||||
|
||||
Profile::LoadResult ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard )
|
||||
int ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard )
|
||||
{
|
||||
LOG->Trace( "LoadingProfile P%d, %s, %d", pn+1, sProfileDir.c_str(), bIsMemCard );
|
||||
|
||||
@@ -180,7 +181,7 @@ bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn )
|
||||
* but we also want to import scores in the case where the player created
|
||||
* a directory for edits before playing, so keep searching if the directory
|
||||
* exists with exists with no scores. */
|
||||
Profile::LoadResult res = LoadProfile( pn, sDir, true );
|
||||
Profile::LoadResult res = (Profile::LoadResult) LoadProfile( pn, sDir, true );
|
||||
if( res == Profile::success )
|
||||
{
|
||||
iLoadedFrom = i;
|
||||
@@ -478,8 +479,9 @@ int ProfileManager::GetSongNumTimesPlayed( const Song* pSong, ProfileSlot slot )
|
||||
return GetProfile(slot)->GetSongNumTimesPlayed( pSong );
|
||||
}
|
||||
|
||||
void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||
void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, PlayerNumber pn, const HighScore &hs_, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||
{
|
||||
HighScore hs = hs_;
|
||||
hs.fPercentDP = max( 0, hs.fPercentDP ); // bump up negative scores
|
||||
|
||||
iPersonalIndexOut = -1;
|
||||
@@ -528,7 +530,7 @@ void ProfileManager::IncrementStepsPlayCount( const Song* pSong, const Steps* pS
|
||||
PROFILEMAN->GetMachineProfile()->IncrementStepsPlayCount( pSong, pSteps );
|
||||
}
|
||||
|
||||
HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const Style *st, ProfileSlot slot, Difficulty dc ) const
|
||||
void ProfileManager::GetHighScoreForDifficulty( const Song *s, const Style *st, ProfileSlot slot, Difficulty dc, HighScore &hsOut ) const
|
||||
{
|
||||
// return max grade of notes in difficulty class
|
||||
vector<Steps*> aNotes;
|
||||
@@ -538,17 +540,18 @@ HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const Style
|
||||
const Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc );
|
||||
|
||||
if( pSteps && PROFILEMAN->IsPersistentProfile(slot) )
|
||||
return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(s,pSteps).GetTopScore();
|
||||
hsOut = PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(s,pSteps).GetTopScore();
|
||||
else
|
||||
return HighScore();
|
||||
hsOut = HighScore();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Course stats
|
||||
//
|
||||
void ProfileManager::AddCourseScore( const Course* pCourse, const Trail* pTrail, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||
void ProfileManager::AddCourseScore( const Course* pCourse, const Trail* pTrail, PlayerNumber pn, const HighScore &hs_, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||
{
|
||||
HighScore hs = hs_;
|
||||
hs.fPercentDP = max( 0, hs.fPercentDP ); // bump up negative scores
|
||||
|
||||
iPersonalIndexOut = -1;
|
||||
@@ -597,8 +600,9 @@ void ProfileManager::IncrementCoursePlayCount( const Course* pCourse, const Trai
|
||||
//
|
||||
// Category stats
|
||||
//
|
||||
void ProfileManager::AddCategoryScore( StepsType st, RankingCategory rc, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||
void ProfileManager::AddCategoryScore( StepsType st, RankingCategory rc, PlayerNumber pn, const HighScore &hs_, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||
{
|
||||
HighScore hs = hs_;
|
||||
hs.sName = RANKING_TO_FILL_IN_MARKER[pn];
|
||||
if( PROFILEMAN->IsPersistentProfile(pn) )
|
||||
PROFILEMAN->GetProfile(pn)->AddCategoryHighScore( st, rc, hs, iPersonalIndexOut );
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
|
||||
#include "PlayerNumber.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "HighScore.h"
|
||||
#include "Difficulty.h"
|
||||
#include "Profile.h"
|
||||
|
||||
class Profile;
|
||||
class Song;
|
||||
@@ -15,6 +13,7 @@ class Steps;
|
||||
class Style;
|
||||
class Course;
|
||||
class Trail;
|
||||
struct HighScore;
|
||||
struct lua_State;
|
||||
|
||||
class ProfileManager
|
||||
@@ -78,20 +77,20 @@ public:
|
||||
//
|
||||
int GetSongNumTimesPlayed( const Song* pSong, ProfileSlot card ) const;
|
||||
bool IsSongNew( const Song* pSong ) const { return GetSongNumTimesPlayed(pSong,PROFILE_SLOT_MACHINE)==0; }
|
||||
void AddStepsScore( const Song* pSong, const Steps* pSteps , PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
||||
void AddStepsScore( const Song* pSong, const Steps* pSteps , PlayerNumber pn, const HighScore &hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
||||
void IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps, PlayerNumber pn );
|
||||
HighScore GetHighScoreForDifficulty( const Song *s, const Style *st, ProfileSlot slot, Difficulty dc ) const;
|
||||
void GetHighScoreForDifficulty( const Song *s, const Style *st, ProfileSlot slot, Difficulty dc, HighScore &hsOut ) const;
|
||||
|
||||
//
|
||||
// Course stats
|
||||
//
|
||||
void AddCourseScore( const Course* pCourse, const Trail* pTrail, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
||||
void AddCourseScore( const Course* pCourse, const Trail* pTrail, PlayerNumber pn, const HighScore &hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
||||
void IncrementCoursePlayCount( const Course* pCourse, const Trail* pTrail, PlayerNumber pn );
|
||||
|
||||
//
|
||||
// Category stats
|
||||
//
|
||||
void AddCategoryScore( StepsType st, RankingCategory rc, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
||||
void AddCategoryScore( StepsType st, RankingCategory rc, PlayerNumber pn, const HighScore &hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
||||
void IncrementCategoryPlayCount( StepsType st, RankingCategory rc, PlayerNumber pn );
|
||||
|
||||
|
||||
@@ -99,7 +98,8 @@ public:
|
||||
void PushSelf( lua_State *L );
|
||||
|
||||
private:
|
||||
Profile::LoadResult LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard );
|
||||
// returns Profile::LoadResult, but we don't want to depend on Profile
|
||||
int LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard );
|
||||
void GetMemoryCardProfileDirectoriesToTry( vector<CString> &asDirsToTry ) const;
|
||||
|
||||
// Directory that contains the profile. Either on local machine or
|
||||
|
||||
Reference in New Issue
Block a user