From: Chris D. <chr...@us...> - 2004-03-25 10:05:23
|
Update of /cvsroot/stepmania/stepmania/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22586 Modified Files: GameState.cpp Profile.cpp Profile.h Song.cpp Log Message: save last played song to profile Index: GameState.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/GameState.cpp,v retrieving revision 1.294 retrieving revision 1.295 diff -u -d -p -r1.294 -r1.295 --- GameState.cpp 25 Mar 2004 05:38:04 -0000 1.294 +++ GameState.cpp 25 Mar 2004 09:54:28 -0000 1.295 @@ -214,10 +214,12 @@ void GameState::PlayersFinalized() // Only set the sort order if it wasn't already set by a ModeChoice if( m_SortOrder == SORT_INVALID && pProfile->m_SortOrder != SORT_INVALID ) m_SortOrder = pProfile->m_SortOrder; - if( pProfile->m_PreferredDifficulty != DIFFICULTY_INVALID ) - GAMESTATE->m_PreferredDifficulty[pn] = pProfile->m_PreferredDifficulty; - if( pProfile->m_PreferredCourseDifficulty != COURSE_DIFFICULTY_INVALID ) - GAMESTATE->m_PreferredCourseDifficulty[pn] = pProfile->m_PreferredCourseDifficulty; + if( pProfile->m_LastDifficulty != DIFFICULTY_INVALID ) + GAMESTATE->m_PreferredDifficulty[pn] = pProfile->m_LastDifficulty; + if( pProfile->m_LastCourseDifficulty != COURSE_DIFFICULTY_INVALID ) + GAMESTATE->m_PreferredCourseDifficulty[pn] = pProfile->m_LastCourseDifficulty; + if( m_pCurSong == NULL && pProfile->m_pLastSong ) + m_pCurSong = pProfile->m_pLastSong; } @@ -311,9 +313,11 @@ void GameState::EndGame() if( IsSongSort(m_SortOrder) ) pProfile->m_SortOrder = m_SortOrder; if( m_PreferredDifficulty[pn] != DIFFICULTY_INVALID ) - pProfile->m_PreferredDifficulty = m_PreferredDifficulty[pn]; + pProfile->m_LastDifficulty = m_PreferredDifficulty[pn]; if( m_PreferredCourseDifficulty[pn] != COURSE_DIFFICULTY_INVALID ) - pProfile->m_PreferredCourseDifficulty = m_PreferredCourseDifficulty[pn]; + pProfile->m_LastCourseDifficulty = m_PreferredCourseDifficulty[pn]; + if( !g_vPlayedStageStats.empty() ) + pProfile->m_pLastSong = g_vPlayedStageStats.back().pSong; PROFILEMAN->SaveProfile( pn ); PROFILEMAN->UnloadProfile( pn ); Index: Profile.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Profile.cpp,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -p -r1.66 -r1.67 --- Profile.cpp 21 Mar 2004 08:47:21 -0000 1.66 +++ Profile.cpp 25 Mar 2004 09:54:28 -0000 1.67 @@ -80,8 +80,9 @@ void Profile::InitGeneralData() m_bUsingProfileDefaultModifiers = false; m_sDefaultModifiers = ""; m_SortOrder = SORT_INVALID; - m_PreferredDifficulty = DIFFICULTY_INVALID; - m_PreferredCourseDifficulty = COURSE_DIFFICULTY_INVALID; + m_LastDifficulty = DIFFICULTY_INVALID; + m_LastCourseDifficulty = COURSE_DIFFICULTY_INVALID; + m_pLastSong = NULL; m_iTotalPlays = 0; m_iTotalPlaySeconds = 0; m_iTotalGameplaySeconds = 0; @@ -597,8 +598,9 @@ XNode* Profile::SaveGeneralDataCreateNod pGeneralDataNode->AppendChild( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers ); pGeneralDataNode->AppendChild( "DefaultModifiers", m_sDefaultModifiers ); pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) ); - pGeneralDataNode->AppendChild( "PreferredDifficulty", DifficultyToString(m_PreferredDifficulty) ); - pGeneralDataNode->AppendChild( "PreferredCourseDifficulty", CourseDifficultyToString(m_PreferredCourseDifficulty) ); + pGeneralDataNode->AppendChild( "LastDifficulty", DifficultyToString(m_LastDifficulty) ); + pGeneralDataNode->AppendChild( "LastCourseDifficulty", CourseDifficultyToString(m_LastCourseDifficulty) ); + if( m_pLastSong ) pGeneralDataNode->AppendChild( "LastSong", m_pLastSong->GetSongDir() ); pGeneralDataNode->AppendChild( "TotalPlays", m_iTotalPlays ); pGeneralDataNode->AppendChild( "TotalPlaySeconds", m_iTotalPlaySeconds ); pGeneralDataNode->AppendChild( "TotalGameplaySeconds", m_iTotalGameplaySeconds ); @@ -737,8 +739,9 @@ void Profile::LoadGeneralDataFromNode( c pNode->GetChildValue( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers ); pNode->GetChildValue( "DefaultModifiers", m_sDefaultModifiers ); pNode->GetChildValue( "SortOrder", s ); m_SortOrder = StringToSortOrder( s ); - pNode->GetChildValue( "PreferredDifficulty", s ); m_PreferredDifficulty = StringToDifficulty( s ); - pNode->GetChildValue( "PreferredCourseDifficulty", s ); m_PreferredCourseDifficulty = StringToCourseDifficulty( s ); + pNode->GetChildValue( "LastDifficulty", s ); m_LastDifficulty = StringToDifficulty( s ); + pNode->GetChildValue( "LastCourseDifficulty", s ); m_LastCourseDifficulty = StringToCourseDifficulty( s ); + pNode->GetChildValue( "LastSong", s ); m_pLastSong = SONGMAN->GetSongFromDir(s); pNode->GetChildValue( "TotalPlays", m_iTotalPlays ); pNode->GetChildValue( "TotalPlaySeconds", m_iTotalPlaySeconds ); pNode->GetChildValue( "TotalGameplaySeconds", m_iTotalGameplaySeconds ); Index: Profile.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Profile.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -p -r1.27 -r1.28 --- Profile.h 14 Mar 2004 17:49:38 -0000 1.27 +++ Profile.h 25 Mar 2004 09:54:28 -0000 1.28 @@ -92,8 +92,9 @@ public: bool m_bUsingProfileDefaultModifiers; CString m_sDefaultModifiers; SortOrder m_SortOrder; - Difficulty m_PreferredDifficulty; - CourseDifficulty m_PreferredCourseDifficulty; + Difficulty m_LastDifficulty; + CourseDifficulty m_LastCourseDifficulty; + Song* m_pLastSong; int m_iTotalPlays; int m_iTotalPlaySeconds; int m_iTotalGameplaySeconds; Index: Song.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Song.cpp,v retrieving revision 1.387 retrieving revision 1.388 diff -u -d -p -r1.387 -r1.388 --- Song.cpp 21 Mar 2004 23:07:46 -0000 1.387 +++ Song.cpp 25 Mar 2004 09:54:28 -0000 1.388 @@ -280,6 +280,7 @@ bool Song::LoadFromSongDir( CString sDir return true; // do load this song } +// Should this be called StepsID? -Chris struct SongID { StepsType st; |