save difficulty and notestype by name instead of number

only save/require description for edits
This commit is contained in:
Glenn Maynard
2004-02-22 03:53:10 +00:00
parent b12ea17458
commit 9d1c482c2e
+17 -9
View File
@@ -621,8 +621,9 @@ XNode* Profile::SaveSongScoresCreateNode() const
const HighScoreList &hsl = pProfile->GetStepsHighScoreList( pSteps ); const HighScoreList &hsl = pProfile->GetStepsHighScoreList( pSteps );
pStepsNode->AppendChild( "StepsType", pSteps->m_StepsType ); pStepsNode->AppendChild( "StepsType", GameManager::NotesTypeToString(pSteps->m_StepsType) );
pStepsNode->AppendChild( "Difficulty", pSteps->GetDifficulty() ); pStepsNode->AppendChild( "Difficulty", DifficultyToString(pSteps->GetDifficulty()) );
if( pSteps->GetDifficulty() == DIFFICULTY_EDIT )
pStepsNode->AppendChild( "Description", pSteps->GetDescription() ); pStepsNode->AppendChild( "Description", pSteps->GetDescription() );
pStepsNode->AppendChild( hsl.CreateNode() ); pStepsNode->AppendChild( hsl.CreateNode() );
@@ -658,21 +659,28 @@ void Profile::LoadSongScoresFromNode( const XNode* pNode )
if( (*steps)->name != "Steps" ) if( (*steps)->name != "Steps" )
continue; continue;
StepsType st; CString str;
if( !(*steps)->GetChildValue("StepsType", (int&)st) ) if( !(*steps)->GetChildValue("StepsType", str) )
WARN_AND_CONTINUE;
const StepsType st = GameManager::StringToNotesType( str );
if( st == STEPS_TYPE_INVALID )
WARN_AND_CONTINUE; WARN_AND_CONTINUE;
Difficulty dc; if( !(*steps)->GetChildValue("Difficulty", str) )
if( !(*steps)->GetChildValue("Difficulty", (int&)dc) )
WARN_AND_CONTINUE; WARN_AND_CONTINUE;
const Difficulty dc = StringToDifficulty( str );
CString sDescription; if( dc == DIFFICULTY_INVALID )
if( !(*steps)->GetChildValue("Description", sDescription) )
WARN_AND_CONTINUE; WARN_AND_CONTINUE;
Steps* pSteps = NULL; Steps* pSteps = NULL;
if( dc == DIFFICULTY_EDIT ) if( dc == DIFFICULTY_EDIT )
{
CString sDescription;
if( !(*steps)->GetChildValue("Description", sDescription) )
WARN_AND_CONTINUE;
pSteps = pSong->GetStepsByDescription( st, sDescription ); pSteps = pSong->GetStepsByDescription( st, sDescription );
}
else else
pSteps = pSong->GetStepsByDifficulty( st, dc ); pSteps = pSong->GetStepsByDifficulty( st, dc );
if( pSteps == NULL ) if( pSteps == NULL )