diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 9c7fc84ff0..0b8ff7fb29 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -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 ); diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 6e78d615d2..5010980414 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -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::SaveGeneralDataCreateNode() const 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( const XNode* pNode ) 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 ); diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index f38f309d60..5ca09520cb 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -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; diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 5b19c34c2b..64d16a134a 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -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;