show totals and unlock totals in Catalog.xml
don't show locked in Catalog.xml
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
|
#include "UnlockManager.h"
|
||||||
|
#include "arch/LoadingWindow/LoadingWindow.h"
|
||||||
|
|
||||||
#define SHOW_PLAY_MODE(pm) THEME->GetMetricB("CatalogXml",ssprintf("ShowPlayMode%s",PlayModeToString(pm).c_str()))
|
#define SHOW_PLAY_MODE(pm) THEME->GetMetricB("CatalogXml",ssprintf("ShowPlayMode%s",PlayModeToString(pm).c_str()))
|
||||||
#define SHOW_STYLE(ps) THEME->GetMetricB("CatalogXml",ssprintf("ShowStyle%s",Capitalize((ps)->m_szName).c_str()))
|
#define SHOW_STYLE(ps) THEME->GetMetricB("CatalogXml",ssprintf("ShowStyle%s",Capitalize((ps)->m_szName).c_str()))
|
||||||
@@ -29,8 +31,14 @@
|
|||||||
#define FOOTER_TEXT THEME->GetMetric ("CatalogXml","FooterText")
|
#define FOOTER_TEXT THEME->GetMetric ("CatalogXml","FooterText")
|
||||||
#define FOOTER_LINK THEME->GetMetric ("CatalogXml","FooterLink")
|
#define FOOTER_LINK THEME->GetMetric ("CatalogXml","FooterLink")
|
||||||
|
|
||||||
void SaveCatalogXml()
|
void SaveCatalogXml( LoadingWindow *loading_window )
|
||||||
{
|
{
|
||||||
|
ASSERT( SONGMAN );
|
||||||
|
ASSERT( UNLOCKMAN );
|
||||||
|
|
||||||
|
if( loading_window )
|
||||||
|
loading_window->SetText( "Saving Catalog.xml ..." );
|
||||||
|
|
||||||
CString fn = CATALOG_XML_FILE;
|
CString fn = CATALOG_XML_FILE;
|
||||||
|
|
||||||
LOG->Trace( "Writing %s ...", fn.c_str() );
|
LOG->Trace( "Writing %s ...", fn.c_str() );
|
||||||
@@ -40,6 +48,72 @@ void SaveCatalogXml()
|
|||||||
|
|
||||||
const vector<StepsType> &vStepsTypesToShow = STEPS_TYPES_TO_SHOW.GetValue();
|
const vector<StepsType> &vStepsTypesToShow = STEPS_TYPES_TO_SHOW.GetValue();
|
||||||
|
|
||||||
|
{
|
||||||
|
XNode* pNode = xml.AppendChild( "Totals" );
|
||||||
|
|
||||||
|
int iTotalSongs = 0;
|
||||||
|
int iTotalSteps = 0;
|
||||||
|
FOREACH_CONST( Song*, SONGMAN->GetAllSongs(), i )
|
||||||
|
{
|
||||||
|
Song *pSong = *i;
|
||||||
|
if( pSong->IsTutorial() )
|
||||||
|
continue; // skip
|
||||||
|
if( UNLOCKMAN->SongIsLocked(pSong) )
|
||||||
|
continue; // skip
|
||||||
|
iTotalSongs++;
|
||||||
|
|
||||||
|
FOREACH_CONST( StepsType, vStepsTypesToShow, st )
|
||||||
|
{
|
||||||
|
FOREACH_CONST( Difficulty, DIFFICULTIES_TO_SHOW.GetValue(), dc )
|
||||||
|
{
|
||||||
|
Steps* pSteps = pSong->GetStepsByDifficulty( *st, *dc, false ); // no autogen
|
||||||
|
if( pSteps == NULL )
|
||||||
|
continue; // skip
|
||||||
|
if( UNLOCKMAN->StepsIsLocked(pSong,pSteps) )
|
||||||
|
continue; // skip
|
||||||
|
iTotalSteps++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int iTotalCourses = 0;
|
||||||
|
vector<Course*> vpCourses;
|
||||||
|
SONGMAN->GetAllCourses( vpCourses, false );
|
||||||
|
for( unsigned i=0; i<vpCourses.size(); i++ )
|
||||||
|
{
|
||||||
|
Course* pCourse = vpCourses[i];
|
||||||
|
// skip non-fixed courses. We don't have any stable data for them other than
|
||||||
|
// the title.
|
||||||
|
if( !pCourse->IsFixed() )
|
||||||
|
continue;
|
||||||
|
if( UNLOCKMAN->CourseIsLocked(pCourse) )
|
||||||
|
continue;
|
||||||
|
iTotalCourses++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int iNumUnlockedSongs = 0;
|
||||||
|
int iNumUnlockedSteps = 0;
|
||||||
|
int iNumUnlockedCourses = 0;
|
||||||
|
FOREACH_CONST( UnlockEntry, UNLOCKMAN->m_UnlockEntries, e )
|
||||||
|
{
|
||||||
|
if( e->IsLocked() )
|
||||||
|
continue;
|
||||||
|
switch( e->m_Type )
|
||||||
|
{
|
||||||
|
case UnlockEntry::TYPE_SONG: iNumUnlockedSongs++; break;
|
||||||
|
case UnlockEntry::TYPE_STEPS: iNumUnlockedSteps++; break;
|
||||||
|
case UnlockEntry::TYPE_COURSE: iNumUnlockedCourses++; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pNode->AppendChild( "TotalSongs", iTotalSongs );
|
||||||
|
pNode->AppendChild( "TotalSteps", iTotalSteps );
|
||||||
|
pNode->AppendChild( "TotalCourses", iTotalCourses );
|
||||||
|
pNode->AppendChild( "NumUnlockedSongs", iNumUnlockedSongs );
|
||||||
|
pNode->AppendChild( "NumUnlockedSteps", iNumUnlockedSteps );
|
||||||
|
pNode->AppendChild( "NumUnlockedCourses", iNumUnlockedCourses );
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
XNode* pNode = xml.AppendChild( "Songs" );
|
XNode* pNode = xml.AppendChild( "Songs" );
|
||||||
|
|
||||||
@@ -50,6 +124,8 @@ void SaveCatalogXml()
|
|||||||
|
|
||||||
if( pSong->IsTutorial() )
|
if( pSong->IsTutorial() )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
if( UNLOCKMAN->SongIsLocked(pSong) )
|
||||||
|
continue; // skip
|
||||||
|
|
||||||
SongID songID;
|
SongID songID;
|
||||||
songID.FromSong( pSong );
|
songID.FromSong( pSong );
|
||||||
@@ -68,6 +144,8 @@ void SaveCatalogXml()
|
|||||||
Steps* pSteps = pSong->GetStepsByDifficulty( *st, *dc, false ); // no autogen
|
Steps* pSteps = pSong->GetStepsByDifficulty( *st, *dc, false ); // no autogen
|
||||||
if( pSteps == NULL )
|
if( pSteps == NULL )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
if( UNLOCKMAN->StepsIsLocked(pSong,pSteps) )
|
||||||
|
continue; // skip
|
||||||
|
|
||||||
StepsID stepsID;
|
StepsID stepsID;
|
||||||
stepsID.FromSteps( pSteps );
|
stepsID.FromSteps( pSteps );
|
||||||
@@ -96,6 +174,8 @@ void SaveCatalogXml()
|
|||||||
// the title.
|
// the title.
|
||||||
if( !pCourse->IsFixed() )
|
if( !pCourse->IsFixed() )
|
||||||
continue;
|
continue;
|
||||||
|
if( UNLOCKMAN->CourseIsLocked(pCourse) )
|
||||||
|
continue;
|
||||||
|
|
||||||
CourseID courseID;
|
CourseID courseID;
|
||||||
courseID.FromCourse( pCourse );
|
courseID.FromCourse( pCourse );
|
||||||
|
|||||||
@@ -4,12 +4,13 @@
|
|||||||
#define CATALOG_XML_H
|
#define CATALOG_XML_H
|
||||||
|
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
class LoadingWindow;
|
||||||
|
|
||||||
const CString CATALOG_XML = "Catalog.xml";
|
const CString CATALOG_XML = "Catalog.xml";
|
||||||
const CString CATALOG_XSL = "Catalog.xsl";
|
const CString CATALOG_XSL = "Catalog.xsl";
|
||||||
const CString CATALOG_XML_FILE = DATA_DIR + "Catalog.xml";
|
const CString CATALOG_XML_FILE = DATA_DIR + "Catalog.xml";
|
||||||
|
|
||||||
void SaveCatalogXml();
|
void SaveCatalogXml( LoadingWindow *ld );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "CourseUtil.h"
|
#include "CourseUtil.h"
|
||||||
#include "RageFileManager.h"
|
#include "RageFileManager.h"
|
||||||
#include "UnlockManager.h"
|
#include "UnlockManager.h"
|
||||||
#include "CatalogXml.h"
|
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "StatsManager.h"
|
#include "StatsManager.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
@@ -84,12 +83,6 @@ void SongManager::InitAll( LoadingWindow *ld )
|
|||||||
InitSongsFromDisk( ld );
|
InitSongsFromDisk( ld );
|
||||||
InitCoursesFromDisk( ld );
|
InitCoursesFromDisk( ld );
|
||||||
InitAutogenCourses();
|
InitAutogenCourses();
|
||||||
|
|
||||||
/* This shouldn't need to be here; if it's taking long enough that this is
|
|
||||||
* even visible, we should be fixing it, not showing a progress display. */
|
|
||||||
if( ld )
|
|
||||||
ld->SetText( "Saving Catalog.xml ..." );
|
|
||||||
SaveCatalogXml();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongManager::Reload( LoadingWindow *ld )
|
void SongManager::Reload( LoadingWindow *ld )
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "RageSurface.h"
|
#include "RageSurface.h"
|
||||||
#include "RageSurface_Load.h"
|
#include "RageSurface_Load.h"
|
||||||
|
|
||||||
#include "arch/arch.h"
|
#include "arch/arch.h"
|
||||||
|
#include "CatalogXml.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// StepMania global classes
|
// StepMania global classes
|
||||||
@@ -1125,6 +1125,11 @@ int main(int argc, char* argv[])
|
|||||||
PROFILEMAN = new ProfileManager;
|
PROFILEMAN = new ProfileManager;
|
||||||
PROFILEMAN->Init(); // must load after SONGMAN
|
PROFILEMAN->Init(); // must load after SONGMAN
|
||||||
UNLOCKMAN = new UnlockManager;
|
UNLOCKMAN = new UnlockManager;
|
||||||
|
|
||||||
|
/* This shouldn't need to be here; if it's taking long enough that this is
|
||||||
|
* even visible, we should be fixing it, not showing a progress display. */
|
||||||
|
SaveCatalogXml( loading_window );
|
||||||
|
|
||||||
NSMAN = new NetworkSyncManager( loading_window );
|
NSMAN = new NetworkSyncManager( loading_window );
|
||||||
MESSAGEMAN = new MessageManager;
|
MESSAGEMAN = new MessageManager;
|
||||||
STATSMAN = new StatsManager;
|
STATSMAN = new StatsManager;
|
||||||
|
|||||||
Reference in New Issue
Block a user