save m_PreferredStepsType, too. Fixes inconsistent behavior

in ScreenSelectMusic::SwitchToPreferredDifficulty due to
m_PreferredDifficulty being set and m_PreferredStepsType
not.
This commit is contained in:
Glenn Maynard
2007-06-15 15:51:33 +00:00
parent 39f75e24c9
commit 6a1db065d2
3 changed files with 10 additions and 0 deletions
+5
View File
@@ -737,6 +737,9 @@ void GameState::LoadCurrentSettingsFromProfile( PlayerNumber pn )
m_PreferredDifficulty[pn].Set( pProfile->m_LastDifficulty ); m_PreferredDifficulty[pn].Set( pProfile->m_LastDifficulty );
if( pProfile->m_LastCourseDifficulty != Difficulty_Invalid ) if( pProfile->m_LastCourseDifficulty != Difficulty_Invalid )
m_PreferredCourseDifficulty[pn].Set( pProfile->m_LastCourseDifficulty ); m_PreferredCourseDifficulty[pn].Set( pProfile->m_LastCourseDifficulty );
// Only set the PreferredStepsType if it wasn't already set by a GameCommand (or by an earlier profile)
if( m_PreferredStepsType == StepsType_Invalid && pProfile->m_LastStepsType != StepsType_Invalid )
m_PreferredStepsType.Set( pProfile->m_LastStepsType );
if( m_pPreferredSong == NULL ) if( m_pPreferredSong == NULL )
m_pPreferredSong = pProfile->m_lastSong.ToSong(); m_pPreferredSong = pProfile->m_lastSong.ToSong();
if( m_pPreferredCourse == NULL ) if( m_pPreferredCourse == NULL )
@@ -759,6 +762,8 @@ void GameState::SaveCurrentSettingsToProfile( PlayerNumber pn )
pProfile->m_LastDifficulty = m_PreferredDifficulty[pn]; pProfile->m_LastDifficulty = m_PreferredDifficulty[pn];
if( m_PreferredCourseDifficulty[pn] != Difficulty_Invalid ) if( m_PreferredCourseDifficulty[pn] != Difficulty_Invalid )
pProfile->m_LastCourseDifficulty = m_PreferredCourseDifficulty[pn]; pProfile->m_LastCourseDifficulty = m_PreferredCourseDifficulty[pn];
if( m_PreferredStepsType != StepsType_Invalid )
pProfile->m_LastStepsType = m_PreferredStepsType;
if( m_pPreferredSong ) if( m_pPreferredSong )
pProfile->m_lastSong.FromSong( m_pPreferredSong ); pProfile->m_lastSong.FromSong( m_pPreferredSong );
if( m_pPreferredCourse ) if( m_pPreferredCourse )
+4
View File
@@ -114,6 +114,7 @@ void Profile::InitGeneralData()
m_SortOrder = SortOrder_Invalid; m_SortOrder = SortOrder_Invalid;
m_LastDifficulty = Difficulty_Invalid; m_LastDifficulty = Difficulty_Invalid;
m_LastCourseDifficulty = Difficulty_Invalid; m_LastCourseDifficulty = Difficulty_Invalid;
m_LastStepsType = StepsType_Invalid;
m_lastSong.Unset(); m_lastSong.Unset();
m_lastCourse.Unset(); m_lastCourse.Unset();
m_iTotalPlays = 0; m_iTotalPlays = 0;
@@ -1064,6 +1065,8 @@ XNode* Profile::SaveGeneralDataCreateNode() const
pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) ); pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) );
pGeneralDataNode->AppendChild( "LastDifficulty", DifficultyToString(m_LastDifficulty) ); pGeneralDataNode->AppendChild( "LastDifficulty", DifficultyToString(m_LastDifficulty) );
pGeneralDataNode->AppendChild( "LastCourseDifficulty", DifficultyToString(m_LastCourseDifficulty) ); pGeneralDataNode->AppendChild( "LastCourseDifficulty", DifficultyToString(m_LastCourseDifficulty) );
if( m_LastStepsType != StepsType_Invalid )
pGeneralDataNode->AppendChild( "LastStepsType", GAMEMAN->StepsTypeToString(m_LastStepsType) );
pGeneralDataNode->AppendChild( m_lastSong.CreateNode() ); pGeneralDataNode->AppendChild( m_lastSong.CreateNode() );
pGeneralDataNode->AppendChild( m_lastCourse.CreateNode() ); pGeneralDataNode->AppendChild( m_lastCourse.CreateNode() );
pGeneralDataNode->AppendChild( "TotalPlays", m_iTotalPlays ); pGeneralDataNode->AppendChild( "TotalPlays", m_iTotalPlays );
@@ -1234,6 +1237,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
pNode->GetChildValue( "SortOrder", s ); m_SortOrder = StringToSortOrder( s ); pNode->GetChildValue( "SortOrder", s ); m_SortOrder = StringToSortOrder( s );
pNode->GetChildValue( "LastDifficulty", s ); m_LastDifficulty = StringToDifficulty( s ); pNode->GetChildValue( "LastDifficulty", s ); m_LastDifficulty = StringToDifficulty( s );
pNode->GetChildValue( "LastCourseDifficulty", s ); m_LastCourseDifficulty = StringToDifficulty( s ); pNode->GetChildValue( "LastCourseDifficulty", s ); m_LastCourseDifficulty = StringToDifficulty( s );
pNode->GetChildValue( "LastStepsType", s ); m_LastStepsType = GAMEMAN->StringToStepsType( s );
pTemp = pNode->GetChild( "Song" ); if( pTemp ) m_lastSong.LoadFromNode( pTemp ); pTemp = pNode->GetChild( "Song" ); if( pTemp ) m_lastSong.LoadFromNode( pTemp );
pTemp = pNode->GetChild( "Course" ); if( pTemp ) m_lastCourse.LoadFromNode( pTemp ); pTemp = pNode->GetChild( "Course" ); if( pTemp ) m_lastCourse.LoadFromNode( pTemp );
pNode->GetChildValue( "TotalPlays", m_iTotalPlays ); pNode->GetChildValue( "TotalPlays", m_iTotalPlays );
+1
View File
@@ -111,6 +111,7 @@ public:
SortOrder m_SortOrder; SortOrder m_SortOrder;
Difficulty m_LastDifficulty; Difficulty m_LastDifficulty;
CourseDifficulty m_LastCourseDifficulty; CourseDifficulty m_LastCourseDifficulty;
StepsType m_LastStepsType;
SongID m_lastSong; SongID m_lastSong;
CourseID m_lastCourse; CourseID m_lastCourse;
int m_iTotalPlays; int m_iTotalPlays;