diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 4e6f546e3d..6482dbb168 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -26,13 +26,14 @@ #include "AnnouncerManager.h" #include "ThemeManager.h" #include "GameManager.h" - #include "RageFile.h" +#include "ProductInfo.h" SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program #define SONGS_DIR BASE_PATH "Songs" SLASH #define COURSES_DIR BASE_PATH "Courses" SLASH +#define STATS_PATH BASE_PATH "stats.html" const CString CATEGORY_RANKING_FILE = BASE_PATH "Data" SLASH "CategoryRanking.dat"; const CString COURSE_RANKING_FILE = BASE_PATH "Data" SLASH "CourseRanking.dat"; const CString NOTES_SCORES_FILE[NUM_MEMORY_CARDS] = { BASE_PATH "Data" SLASH "Player1NotesScores.dat", BASE_PATH "Data" SLASH "Player2NotesScores.dat", BASE_PATH "Data" SLASH "MachineNotesScores.dat" }; @@ -91,6 +92,8 @@ SongManager::~SongManager() { SaveMachineScoresToDisk(); + WriteStatsWebPage(); + FreeSongs(); } @@ -1223,3 +1226,117 @@ void SongManager::UpdateRankingCourses() m_pCourses[i]->SortOrder_Ranking = 1; } } + +// TODO: Move this to a different file. No need to clutter SongManager. +void SongManager::WriteStatsWebPage() +{ + FILE* fp = fopen( STATS_PATH, "w" ); + if( fp == NULL ) + return; + + fprintf( fp, + "\n" + "
\n" + "| image | title | " ); + else + fprintf( fp, " | %s ", pSong->GetTranslitMainTitle().c_str() ); + fprintf( fp, "%s ", pSong->GetTranslitSubTitle().c_str() ); + fprintf( fp, "%s | ", pSong->GetTranslitArtist().c_str() );
+ fprintf( fp, "\n" );
+
+ }
+ fprintf( fp, "
| title | " ); + unsigned j; + for( j=0; j
| " ); + for( j=0; j | %s | ", pSong->GetTranslitMainTitle().c_str() ); + + for( unsigned j=0; j%d | \n", pSteps->GetMeter() ); + else + fprintf( fp, "\n" ); + } + } + + fprintf( fp, "" ); + + } + fprintf( fp, " |