fix fill machine stats
This commit is contained in:
@@ -106,86 +106,6 @@ static CString ClearMemoryCardEdits()
|
||||
return ssprintf(EDITS_CLEARED.GetValue(),iNumSuccessful,iNumAttempted-iNumSuccessful);
|
||||
}
|
||||
|
||||
static HighScore MakeRandomHighScore( float fPercentDP )
|
||||
{
|
||||
HighScore hs;
|
||||
hs.SetName( "FAKE" );
|
||||
hs.SetGrade( (Grade)SCALE( rand()%5, 0, 4, Grade_Tier01, Grade_Tier05 ) );
|
||||
hs.SetScore( rand()%100*1000 );
|
||||
hs.SetPercentDP( fPercentDP );
|
||||
hs.SetSurviveSeconds( randomf(30.0f, 100.0f) );
|
||||
PlayerOptions po;
|
||||
po.ChooseRandomModifiers();
|
||||
hs.SetModifiers( po.GetString() );
|
||||
hs.SetDateTime( DateTime::GetNowDateTime() );
|
||||
hs.SetPlayerGuid( Profile::MakeGuid() );
|
||||
hs.SetMachineGuid( Profile::MakeGuid() );
|
||||
hs.SetProductID( rand()%10 );
|
||||
FOREACH_TapNoteScore( tns )
|
||||
hs.SetTapNoteScore( tns, rand() % 100 );
|
||||
FOREACH_HoldNoteScore( hns )
|
||||
hs.SetHoldNoteScore( hns, rand() % 100 );
|
||||
RadarValues rv;
|
||||
FOREACH_RadarCategory( rc )
|
||||
rv.m_Values.f[rc] = randomf( 0, 1 );
|
||||
hs.SetRadarValues( rv );
|
||||
|
||||
return hs;
|
||||
}
|
||||
|
||||
static void FillProfile( Profile *pProfile )
|
||||
{
|
||||
// Choose a percent for all scores. This is useful for testing unlocks
|
||||
// where some elements are unlocked at a certain percent complete
|
||||
float fPercentDP = randomf( 0.6f, 1.2f );
|
||||
CLAMP( fPercentDP, 0.0f, 1.0f );
|
||||
|
||||
int iCount = pProfile->IsMachine()?
|
||||
PREFSMAN->m_iMaxHighScoresPerListForMachine.Get():
|
||||
PREFSMAN->m_iMaxHighScoresPerListForPlayer.Get();
|
||||
|
||||
vector<Song*> vpAllSongs = SONGMAN->GetAllSongs();
|
||||
FOREACH( Song*, vpAllSongs, pSong )
|
||||
{
|
||||
vector<Steps*> vpAllSteps = (*pSong)->GetAllSteps();
|
||||
FOREACH( Steps*, vpAllSteps, pSteps )
|
||||
{
|
||||
pProfile->IncrementStepsPlayCount( *pSong, *pSteps );
|
||||
for( int i=0; i<iCount; i++ )
|
||||
{
|
||||
int iIndex = 0;
|
||||
pProfile->AddStepsHighScore( *pSong, *pSteps, MakeRandomHighScore(fPercentDP), iIndex );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vector<Course*> vpAllCourses;
|
||||
SONGMAN->GetAllCourses( vpAllCourses, true );
|
||||
FOREACH( Course*, vpAllCourses, pCourse )
|
||||
{
|
||||
vector<Trail*> vpAllTrails;
|
||||
(*pCourse)->GetAllTrails( vpAllTrails );
|
||||
FOREACH( Trail*, vpAllTrails, pTrail )
|
||||
{
|
||||
pProfile->IncrementCoursePlayCount( *pCourse, *pTrail );
|
||||
for( int i=0; i<iCount; i++ )
|
||||
{
|
||||
int iIndex = 0;
|
||||
pProfile->AddCourseHighScore( *pCourse, *pTrail, MakeRandomHighScore(fPercentDP), iIndex );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static LocalizedString MACHINE_STATS_FILLED( "ScreenServiceAction", "Machine stats filled." );
|
||||
static CString FillMachineStats()
|
||||
{
|
||||
Profile* pProfile = PROFILEMAN->GetMachineProfile();
|
||||
FillProfile( pProfile );
|
||||
|
||||
PROFILEMAN->SaveMachineProfile();
|
||||
return MACHINE_STATS_FILLED.GetValue();
|
||||
}
|
||||
|
||||
static LocalizedString STATS_NOT_SAVED ( "ScreenServiceAction", "Stats not saved - No memory cards ready." );
|
||||
static LocalizedString MACHINE_STATS_SAVED ( "ScreenServiceAction", "Machine stats saved to P%d card." );
|
||||
@@ -457,17 +377,16 @@ void ScreenServiceAction::Init()
|
||||
|
||||
CString (*pfn)() = NULL;
|
||||
|
||||
if( sAction == "ClearBookkeepingData" ) pfn = ClearBookkeepingData;
|
||||
else if( sAction == "ClearMachineStats" ) pfn = ClearMachineStats;
|
||||
else if( sAction == "ClearMachineEdits" ) pfn = ClearMachineEdits;
|
||||
else if( sAction == "ClearMemoryCardEdits" ) pfn = ClearMemoryCardEdits;
|
||||
else if( sAction == "FillMachineStats" ) pfn = FillMachineStats;
|
||||
if( sAction == "ClearBookkeepingData" ) pfn = ClearBookkeepingData;
|
||||
else if( sAction == "ClearMachineStats" ) pfn = ClearMachineStats;
|
||||
else if( sAction == "ClearMachineEdits" ) pfn = ClearMachineEdits;
|
||||
else if( sAction == "ClearMemoryCardEdits" ) pfn = ClearMemoryCardEdits;
|
||||
else if( sAction == "TransferStatsMachineToMemoryCard" ) pfn = TransferStatsMachineToMemoryCard;
|
||||
else if( sAction == "TransferStatsMemoryCardToMachine" ) pfn = TransferStatsMemoryCardToMachine;
|
||||
else if( sAction == "CopyEditsMachineToMemoryCard" ) pfn = CopyEditsMachineToMemoryCard;
|
||||
else if( sAction == "CopyEditsMemoryCardToMachine" ) pfn = CopyEditsMemoryCardToMachine;
|
||||
else if( sAction == "SyncEditsMachineToMemoryCard" ) pfn = SyncEditsMachineToMemoryCard;
|
||||
else if( sAction == "ResetPreferences" ) pfn = ResetPreferences;
|
||||
else if( sAction == "ResetPreferences" ) pfn = ResetPreferences;
|
||||
|
||||
ASSERT_M( pfn, sAction );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user