From 1234cab21313fff9f015a339732e2ab93504c44b Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Wed, 13 Jul 2011 03:26:08 -0400 Subject: [PATCH] Let [CustomDifficulty] work for all StepTypes. --- Docs/Changelog_sm5.txt | 5 ++++ src/Difficulty.cpp | 53 ++++++++++++++++-------------------------- 2 files changed, 25 insertions(+), 33 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index bc3b3d65db..a6cc1ea453 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -8,6 +8,11 @@ ________________________________________________________________________________ StepMania 5.0 ????????? | 20110??? -------------------------------------------------------------------------------- +2011/07/13 +---------- +* [Difficulty] Allow ALL StepsTypes to use CustomDifficulty properly. + There was some unfair targeting of Couple and Routine. [Wolfman2000] + 2011/07/12 ---------- * [OptionRowHandler] Add a new metric to ScreenOptionsMaster: diff --git a/src/Difficulty.cpp b/src/Difficulty.cpp index e37c5a4745..d80b121051 100644 --- a/src/Difficulty.cpp +++ b/src/Difficulty.cpp @@ -69,47 +69,34 @@ RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct ) const StepsTypeInfo &sti = GAMEMAN->GetStepsTypeInfo( st ); - switch( sti.m_StepsTypeCategory ) + if( dc == Difficulty_Edit ) { - DEFAULT_FAIL(sti.m_StepsTypeCategory); - case StepsTypeCategory_Single: - case StepsTypeCategory_Double: - if( dc == Difficulty_Edit ) + return "Edit"; + } + // OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting + vector vsNames; + split( NAMES, ",", vsNames ); + FOREACH( RString, vsNames, sName ) + { + ThemeMetric STEPS_TYPE("CustomDifficulty",(*sName)+"StepsType"); + if( STEPS_TYPE == StepsType_Invalid || st == STEPS_TYPE ) // match { - return "Edit"; - } - else - { - // OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting - vector vsNames; - split( NAMES, ",", vsNames ); - FOREACH( RString, vsNames, sName ) + ThemeMetric DIFFICULTY("CustomDifficulty",(*sName)+"Difficulty"); + if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match { - ThemeMetric STEPS_TYPE("CustomDifficulty",(*sName)+"StepsType"); - if( STEPS_TYPE == StepsType_Invalid || st == STEPS_TYPE ) // match + ThemeMetric COURSE_TYPE("CustomDifficulty",(*sName)+"CourseType"); + if( COURSE_TYPE == CourseType_Invalid || ct == COURSE_TYPE ) // match { - ThemeMetric DIFFICULTY("CustomDifficulty",(*sName)+"Difficulty"); - if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match - { - ThemeMetric COURSE_TYPE("CustomDifficulty",(*sName)+"CourseType"); - if( COURSE_TYPE == CourseType_Invalid || ct == COURSE_TYPE ) // match - { - ThemeMetric STRING("CustomDifficulty",(*sName)+"String"); - return STRING.GetValue(); - } - } + ThemeMetric STRING("CustomDifficulty",(*sName)+"String"); + return STRING.GetValue(); } } - // no matching CustomDifficulty, so use a regular difficulty name - if( dc == Difficulty_Invalid ) - return RString(); - return DifficultyToString( dc ); } - case StepsTypeCategory_Couple: - return "Couple"; - case StepsTypeCategory_Routine: - return "Routine"; } + // no matching CustomDifficulty, so use a regular difficulty name + if( dc == Difficulty_Invalid ) + return RString(); + return DifficultyToString( dc ); } LuaFunction( GetCustomDifficulty, GetCustomDifficulty(Enum::Check(L,1), Enum::Check(L, 2), Enum::Check(L, 3, true)) );