Make CourseDifficulty its own enum.
This commit is contained in:
@@ -59,17 +59,18 @@ static const char *CourseDifficultyNames[] =
|
||||
XToString( CourseDifficulty, NUM_Difficulty );
|
||||
XToLocalizedString( CourseDifficulty );
|
||||
StringToX( CourseDifficulty );
|
||||
LuaXType( CourseDifficulty );
|
||||
|
||||
LuaFunction( CourseDifficultyToLocalizedString, CourseDifficultyToLocalizedString(Enum::Check<Difficulty>(L, 1)) );
|
||||
LuaFunction( CourseDifficultyToLocalizedString, CourseDifficultyToLocalizedString(Enum::Check<CourseDifficulty>(L, 1)) );
|
||||
|
||||
CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd )
|
||||
{
|
||||
for( CourseDifficulty d=(CourseDifficulty)(cd+1); d<NUM_Difficulty; ((int&)d)++ )
|
||||
for( CourseDifficulty d=enum_add2(cd,1); d<NUM_CourseDifficulty; enum_add(d, 1) )
|
||||
{
|
||||
if( GAMESTATE->IsCourseDifficultyShown(d) )
|
||||
return d;
|
||||
}
|
||||
return Difficulty_Invalid;
|
||||
return CourseDifficulty_Invalid;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+18
-11
@@ -23,18 +23,25 @@ const RString& DifficultyToLocalizedString( Difficulty dc );
|
||||
Difficulty StringToDifficulty( const RString& sDC );
|
||||
LuaDeclareType( Difficulty );
|
||||
|
||||
enum CourseDifficulty
|
||||
{
|
||||
COURSE_DIFFICULTY_BEGINNER,
|
||||
COURSE_DIFFICULTY_EASY,
|
||||
COURSE_DIFFICULTY_REGULAR,
|
||||
COURSE_DIFFICULTY_DIFFICULT,
|
||||
COURSE_DIFFICULTY_CHALLENGE,
|
||||
COURSE_DIFFICULTY_EDIT,
|
||||
NUM_CourseDifficulty,
|
||||
CourseDifficulty_Invalid
|
||||
};
|
||||
#define FOREACH_CourseDifficulty( cd ) FOREACH_ENUM( CourseDifficulty, cd )
|
||||
#define FOREACH_ShownCourseDifficulty( cd ) for( CourseDifficulty cd=GetNextShownCourseDifficulty((CourseDifficulty)-1); cd!=CourseDifficulty_Invalid; cd=GetNextShownCourseDifficulty(cd) )
|
||||
|
||||
typedef Difficulty CourseDifficulty;
|
||||
#define NUM_CourseDifficulty NUM_Difficulty
|
||||
#define CourseDifficulty_Invalid Difficulty_Invalid
|
||||
#define FOREACH_CourseDifficulty FOREACH_Difficulty
|
||||
#define FOREACH_ShownCourseDifficulty( cd ) for( Difficulty cd=GetNextShownCourseDifficulty((CourseDifficulty)-1); cd!=Difficulty_Invalid; cd=GetNextShownCourseDifficulty(cd) )
|
||||
|
||||
const RString& CourseDifficultyToString( Difficulty dc );
|
||||
const RString& CourseDifficultyToLocalizedString( Difficulty dc );
|
||||
Difficulty StringToCourseDifficulty( const RString& sDC );
|
||||
|
||||
Difficulty GetNextShownCourseDifficulty( Difficulty pn );
|
||||
const RString& CourseDifficultyToString( CourseDifficulty dc );
|
||||
const RString& CourseDifficultyToLocalizedString( CourseDifficulty dc );
|
||||
CourseDifficulty StringToCourseDifficulty( const RString& sDC );
|
||||
LuaDeclareType( CourseDifficulty );
|
||||
CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty pn );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user