diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index d3d53e43c3..fb4a1aa687 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -25,6 +25,8 @@ #include "ThemeManager.h" #include "GameManager.h" +#include + SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program @@ -34,7 +36,7 @@ const CString NOTES_SCORES_FILE[NUM_MEMORY_CARDS] = { "Player1NotesScores.dat", const CString COURSE_SCORES_FILE[NUM_MEMORY_CARDS] = { "Player1CourseScores.dat", "Player2CourseScores.dat", "MachineCourseScores.dat" }; const int CATEGORY_RANKING_VERSION = 1; const int COURSE_RANKING_VERSION = 1; -const int NOTES_SCORES_VERSION = 1; +const int NOTES_SCORES_VERSION = 2; const int COURSE_SCORES_VERSION = 1; @@ -302,37 +304,54 @@ void SongManager::InitMachineScoresFromDisk() // notes scores for( int c=0; cGetSongFromDir( szSongDir ); + sscanf(line.GetString(), "%u", &uNumNotes); + + Song* pSong = this->GetSongFromDir( sSongDir ); for( unsigned i=0; iGetNotes( nt, szDescription ); + pNotes = pSong->GetNotes( nt, sDescription ); else pNotes = pSong->GetNotes( nt, dc ); - + } int iNumTimesPlayed; Grade grade; float fScore; - fscanf(fp, "%d %d %f\n", &iNumTimesPlayed, &grade, &fScore ); + + getline(f, line); + sscanf(line.GetString(), "%d %d %f\n", &iNumTimesPlayed, &grade, &fScore ); + if( pNotes ) { pNotes->m_MemCardScores[c].iNumTimesPlayed = iNumTimesPlayed; @@ -342,7 +361,6 @@ void SongManager::InitMachineScoresFromDisk() } } } - fclose(fp); } } @@ -474,7 +492,7 @@ void SongManager::SaveMachineScoresToDisk() Notes* pNotes = vNotes[i]; ASSERT(pNotes); - fprintf(fp, "%d\n%d\n%s\n", + fprintf(fp, "%d %d\n%s\n", pNotes->m_NotesType, pNotes->GetDifficulty(), pNotes->GetDescription().c_str() );