From e623ca8d3dd94a051304fd4277ef79ff25f8498d Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 28 Nov 2008 18:08:12 +0000 Subject: [PATCH] StringToDifficulty->BackwardCompatibleStringToDifficulty. Don't accept song file backward compatible names other places, like in metrics --- stepmania/src/Difficulty.cpp | 2 +- stepmania/src/Difficulty.h | 3 +++ stepmania/src/NotesLoaderDWI.cpp | 2 +- stepmania/src/NotesLoaderSM.cpp | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/stepmania/src/Difficulty.cpp b/stepmania/src/Difficulty.cpp index 5cfb9c5d50..08cb57c4eb 100644 --- a/stepmania/src/Difficulty.cpp +++ b/stepmania/src/Difficulty.cpp @@ -42,7 +42,7 @@ LuaFunction( DifficultyDisplayTypeToLocalizedString, DifficultyDisplayTypeToLoca /* TODO: Format specific hacks should be moved into the file loader for * that format. We don't want to carry these hacks forward to file * formats that don't need them. */ -Difficulty StringToDifficulty( const RString& sDC ) +Difficulty BackwardCompatibleStringToDifficulty( const RString& sDC ) { RString s2 = sDC; s2.MakeLower(); diff --git a/stepmania/src/Difficulty.h b/stepmania/src/Difficulty.h index 243f1f2ce4..48ca69108b 100644 --- a/stepmania/src/Difficulty.h +++ b/stepmania/src/Difficulty.h @@ -22,6 +22,8 @@ const RString& DifficultyToString( Difficulty dc ); Difficulty StringToDifficulty( const RString& sDC ); LuaDeclareType( Difficulty ); +Difficulty BackwardCompatibleStringToDifficulty( const RString& sDC ); + typedef Difficulty CourseDifficulty; const int NUM_CourseDifficulty = NUM_Difficulty; #define FOREACH_ShownCourseDifficulty( cd ) for( Difficulty cd=GetNextShownCourseDifficulty((CourseDifficulty)-1); cd!=Difficulty_Invalid; cd=GetNextShownCourseDifficulty(cd) ) @@ -31,6 +33,7 @@ const RString& CourseDifficultyToLocalizedString( Difficulty dc ); Difficulty GetNextShownCourseDifficulty( Difficulty pn ); + enum DifficultyDisplayType // ID for coloring and localized strings in StepsDisplay { DifficultyDisplayType_Single_Beginner, diff --git a/stepmania/src/NotesLoaderDWI.cpp b/stepmania/src/NotesLoaderDWI.cpp index e4d99119c0..3795301211 100644 --- a/stepmania/src/NotesLoaderDWI.cpp +++ b/stepmania/src/NotesLoaderDWI.cpp @@ -173,7 +173,7 @@ static bool LoadFromDWITokens( int iNumFeet = atoi(sNumFeet); // out.SetDescription(sDescription); // Don't put garbage in the description. out.SetMeter(iNumFeet); - out.SetDifficulty( StringToDifficulty(sDescription) ); + out.SetDifficulty( BackwardCompatibleStringToDifficulty(sDescription) ); NoteData newNoteData; newNoteData.SetNumTracks( g_mapDanceNoteToNoteDataColumn.size() ); diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index ac0a184502..10045ab29b 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -34,7 +34,7 @@ static void LoadFromSMTokens( out.m_StepsType = GameManager::StringToStepsType( sStepsType ); out.SetDescription( sDescription ); - out.SetDifficulty( StringToDifficulty(sDifficulty) ); + out.SetDifficulty( BackwardCompatibleStringToDifficulty(sDifficulty) ); // HACK: We used to store SMANIAC as Difficulty_Hard with special description. // Now, it has its own Difficulty_Challenge