Let [CustomDifficulty] work for all StepTypes.

This commit is contained in:
Jason Felds
2011-07-13 03:26:08 -04:00
parent 38e11061d9
commit 1234cab213
2 changed files with 25 additions and 33 deletions
+5
View File
@@ -8,6 +8,11 @@ ________________________________________________________________________________
StepMania 5.0 ????????? | 20110??? 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 2011/07/12
---------- ----------
* [OptionRowHandler] Add a new metric to ScreenOptionsMaster: * [OptionRowHandler] Add a new metric to ScreenOptionsMaster:
+20 -33
View File
@@ -69,47 +69,34 @@ RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct )
const StepsTypeInfo &sti = GAMEMAN->GetStepsTypeInfo( st ); const StepsTypeInfo &sti = GAMEMAN->GetStepsTypeInfo( st );
switch( sti.m_StepsTypeCategory ) if( dc == Difficulty_Edit )
{ {
DEFAULT_FAIL(sti.m_StepsTypeCategory); return "Edit";
case StepsTypeCategory_Single: }
case StepsTypeCategory_Double: // OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting
if( dc == Difficulty_Edit ) vector<RString> vsNames;
split( NAMES, ",", vsNames );
FOREACH( RString, vsNames, sName )
{
ThemeMetric<StepsType> STEPS_TYPE("CustomDifficulty",(*sName)+"StepsType");
if( STEPS_TYPE == StepsType_Invalid || st == STEPS_TYPE ) // match
{ {
return "Edit"; ThemeMetric<Difficulty> DIFFICULTY("CustomDifficulty",(*sName)+"Difficulty");
} if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match
else
{
// OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting
vector<RString> vsNames;
split( NAMES, ",", vsNames );
FOREACH( RString, vsNames, sName )
{ {
ThemeMetric<StepsType> STEPS_TYPE("CustomDifficulty",(*sName)+"StepsType"); ThemeMetric<CourseType> COURSE_TYPE("CustomDifficulty",(*sName)+"CourseType");
if( STEPS_TYPE == StepsType_Invalid || st == STEPS_TYPE ) // match if( COURSE_TYPE == CourseType_Invalid || ct == COURSE_TYPE ) // match
{ {
ThemeMetric<Difficulty> DIFFICULTY("CustomDifficulty",(*sName)+"Difficulty"); ThemeMetric<RString> STRING("CustomDifficulty",(*sName)+"String");
if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match return STRING.GetValue();
{
ThemeMetric<CourseType> COURSE_TYPE("CustomDifficulty",(*sName)+"CourseType");
if( COURSE_TYPE == CourseType_Invalid || ct == COURSE_TYPE ) // match
{
ThemeMetric<RString> 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<StepsType>(L,1), Enum::Check<Difficulty>(L, 2), Enum::Check<CourseType>(L, 3, true)) ); LuaFunction( GetCustomDifficulty, GetCustomDifficulty(Enum::Check<StepsType>(L,1), Enum::Check<Difficulty>(L, 2), Enum::Check<CourseType>(L, 3, true)) );