handle difficulty aliases in StringToDifficulty

This commit is contained in:
Glenn Maynard
2003-02-05 19:48:02 +00:00
parent 7db930ed2f
commit a7d4031cb4
2 changed files with 19 additions and 24 deletions
+18 -6
View File
@@ -30,14 +30,26 @@ CString DifficultyToString( Difficulty dc )
} }
} }
/* We prefer the above names; recognize a number of others, too. (They'l
* get normalized when written to SMs, etc.) */
Difficulty StringToDifficulty( CString sDC ) Difficulty StringToDifficulty( CString sDC )
{ {
for( int i=0; i<NUM_DIFFICULTIES; i++ ) sDC.MakeLower();
{ if( sDC == "beginner" ) return DIFFICULTY_BEGINNER;
Difficulty dc = (Difficulty)i; else if( sDC == "easy" ) return DIFFICULTY_EASY;
if( sDC == DifficultyToString(dc) ) else if( sDC == "basic" ) return DIFFICULTY_EASY;
return dc; else if( sDC == "light" ) return DIFFICULTY_EASY;
} else if( sDC == "medium" ) return DIFFICULTY_MEDIUM;
else if( sDC == "another" ) return DIFFICULTY_MEDIUM;
else if( sDC == "trick" ) return DIFFICULTY_MEDIUM;
else if( sDC == "standard" ) return DIFFICULTY_MEDIUM;
else if( sDC == "hard" ) return DIFFICULTY_HARD;
else if( sDC == "ssr" ) return DIFFICULTY_HARD;
else if( sDC == "maniac" ) return DIFFICULTY_HARD;
else if( sDC == "heavy" ) return DIFFICULTY_HARD;
else if( sDC == "smaniac" ) return DIFFICULTY_CHALLENGE;
else if( sDC == "challenge" ) return DIFFICULTY_CHALLENGE;
return DIFFICULTY_INVALID; return DIFFICULTY_INVALID;
} }
+1 -18
View File
@@ -122,24 +122,7 @@ RageColor Notes::GetColor() const
void Notes::TidyUpData() void Notes::TidyUpData()
{ {
if( GetDifficulty() == DIFFICULTY_INVALID ) if( GetDifficulty() == DIFFICULTY_INVALID )
{ SetDifficulty(StringToDifficulty(GetDescription()));
CString sDescription = GetDescription();
sDescription.MakeLower();
if( sDescription == "beginner" ) SetDifficulty(DIFFICULTY_BEGINNER);
else if( sDescription == "easy" ) SetDifficulty(DIFFICULTY_EASY);
else if( sDescription == "basic" ) SetDifficulty(DIFFICULTY_EASY);
else if( sDescription == "light" ) SetDifficulty(DIFFICULTY_EASY);
else if( sDescription == "medium" ) SetDifficulty(DIFFICULTY_MEDIUM);
else if( sDescription == "another" ) SetDifficulty(DIFFICULTY_MEDIUM);
else if( sDescription == "trick" ) SetDifficulty(DIFFICULTY_MEDIUM);
else if( sDescription == "standard" ) SetDifficulty(DIFFICULTY_MEDIUM);
else if( sDescription == "hard" ) SetDifficulty(DIFFICULTY_HARD);
else if( sDescription == "ssr" ) SetDifficulty(DIFFICULTY_HARD);
else if( sDescription == "maniac" ) SetDifficulty(DIFFICULTY_HARD);
else if( sDescription == "heavy" ) SetDifficulty(DIFFICULTY_HARD);
else if( sDescription == "smaniac" ) SetDifficulty(DIFFICULTY_CHALLENGE);
else if( sDescription == "challenge" ) SetDifficulty(DIFFICULTY_CHALLENGE);
}
if( GetDifficulty() == DIFFICULTY_INVALID ) if( GetDifficulty() == DIFFICULTY_INVALID )
{ {