don't allow StringToX for *_INVALID values
This commit is contained in:
@@ -13,7 +13,7 @@ static const CString DifficultyNames[NUM_DIFFICULTIES] = {
|
|||||||
"Challenge",
|
"Challenge",
|
||||||
"Edit",
|
"Edit",
|
||||||
};
|
};
|
||||||
XToString( Difficulty );
|
XToString( Difficulty, NUM_DIFFICULTIES );
|
||||||
XToThemedString( Difficulty, NUM_DIFFICULTIES );
|
XToThemedString( Difficulty, NUM_DIFFICULTIES );
|
||||||
|
|
||||||
/* We prefer the above names; recognize a number of others, too. (They'l
|
/* We prefer the above names; recognize a number of others, too. (They'l
|
||||||
@@ -66,7 +66,7 @@ static const CString CourseDifficultyNames[NUM_DIFFICULTIES] =
|
|||||||
"Challenge",
|
"Challenge",
|
||||||
"Edit",
|
"Edit",
|
||||||
};
|
};
|
||||||
XToString( CourseDifficulty );
|
XToString( CourseDifficulty, NUM_DIFFICULTIES );
|
||||||
XToThemedString( CourseDifficulty, NUM_DIFFICULTIES );
|
XToThemedString( CourseDifficulty, NUM_DIFFICULTIES );
|
||||||
StringToX( CourseDifficulty );
|
StringToX( CourseDifficulty );
|
||||||
|
|
||||||
|
|||||||
@@ -37,12 +37,12 @@ static inline void enum_add( T &val, int iAmt )
|
|||||||
|
|
||||||
static const CString EMPTY_STRING;
|
static const CString EMPTY_STRING;
|
||||||
|
|
||||||
#define XToString(X) \
|
#define XToString(X, CNT) \
|
||||||
const CString& X##ToString( X x ) \
|
const CString& X##ToString( X x ) \
|
||||||
{ \
|
{ \
|
||||||
if( x == ARRAYSIZE(X##Names)+1 ) \
|
if( x == ARRAYSIZE(X##Names)+1 ) \
|
||||||
return EMPTY_STRING; \
|
return EMPTY_STRING; \
|
||||||
ASSERT(unsigned(x) < ARRAYSIZE(X##Names)); \
|
ASSERT(unsigned(x) < CNT); \
|
||||||
return X##Names[x]; \
|
return X##Names[x]; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ static const CString RadarCategoryNames[NUM_RADAR_CATEGORIES] = {
|
|||||||
"Mines",
|
"Mines",
|
||||||
"Hands",
|
"Hands",
|
||||||
};
|
};
|
||||||
XToString( RadarCategory );
|
XToString( RadarCategory, NUM_RADAR_CATEGORIES );
|
||||||
XToThemedString( RadarCategory, NUM_RADAR_CATEGORIES );
|
XToThemedString( RadarCategory, NUM_RADAR_CATEGORIES );
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ static const CString PlayModeNames[NUM_PLAY_MODES] = {
|
|||||||
"Battle",
|
"Battle",
|
||||||
"Rave",
|
"Rave",
|
||||||
};
|
};
|
||||||
XToString( PlayMode );
|
XToString( PlayMode, NUM_PLAY_MODES );
|
||||||
XToThemedString( PlayMode, NUM_PLAY_MODES );
|
XToThemedString( PlayMode, NUM_PLAY_MODES );
|
||||||
StringToX( PlayMode );
|
StringToX( PlayMode );
|
||||||
static void LuaPlayMode(lua_State* L)
|
static void LuaPlayMode(lua_State* L)
|
||||||
@@ -78,7 +78,7 @@ static const CString RankingCategoryNames[NUM_RANKING_CATEGORIES] = {
|
|||||||
"c",
|
"c",
|
||||||
"d",
|
"d",
|
||||||
};
|
};
|
||||||
XToString( RankingCategory );
|
XToString( RankingCategory, NUM_RANKING_CATEGORIES );
|
||||||
StringToX( RankingCategory );
|
StringToX( RankingCategory );
|
||||||
|
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ static const CString CoinModeNames[NUM_COIN_MODES] = {
|
|||||||
"pay",
|
"pay",
|
||||||
"free",
|
"free",
|
||||||
};
|
};
|
||||||
XToString( CoinMode );
|
XToString( CoinMode, NUM_COIN_MODES );
|
||||||
|
|
||||||
|
|
||||||
static const CString PremiumNames[NUM_PREMIUMS] = {
|
static const CString PremiumNames[NUM_PREMIUMS] = {
|
||||||
@@ -95,7 +95,7 @@ static const CString PremiumNames[NUM_PREMIUMS] = {
|
|||||||
"doubles",
|
"doubles",
|
||||||
"joint",
|
"joint",
|
||||||
};
|
};
|
||||||
XToString( Premium );
|
XToString( Premium, NUM_PREMIUMS );
|
||||||
|
|
||||||
|
|
||||||
static const CString SortOrderNames[NUM_SORT_ORDERS] = {
|
static const CString SortOrderNames[NUM_SORT_ORDERS] = {
|
||||||
@@ -118,7 +118,7 @@ static const CString SortOrderNames[NUM_SORT_ORDERS] = {
|
|||||||
"Endless",
|
"Endless",
|
||||||
"Roulette",
|
"Roulette",
|
||||||
};
|
};
|
||||||
XToString( SortOrder );
|
XToString( SortOrder, NUM_SORT_ORDERS );
|
||||||
StringToX( SortOrder );
|
StringToX( SortOrder );
|
||||||
|
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ static const CString TapNoteScoreNames[NUM_TAP_NOTE_SCORES] = {
|
|||||||
"Perfect",
|
"Perfect",
|
||||||
"Marvelous",
|
"Marvelous",
|
||||||
};
|
};
|
||||||
XToString( TapNoteScore );
|
XToString( TapNoteScore, NUM_TAP_NOTE_SCORES );
|
||||||
StringToX( TapNoteScore );
|
StringToX( TapNoteScore );
|
||||||
XToThemedString( TapNoteScore, NUM_TAP_NOTE_SCORES );
|
XToThemedString( TapNoteScore, NUM_TAP_NOTE_SCORES );
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ static const CString HoldNoteScoreNames[NUM_HOLD_NOTE_SCORES] = {
|
|||||||
"NG",
|
"NG",
|
||||||
"OK",
|
"OK",
|
||||||
};
|
};
|
||||||
XToString( HoldNoteScore );
|
XToString( HoldNoteScore, NUM_HOLD_NOTE_SCORES );
|
||||||
StringToX( HoldNoteScore );
|
StringToX( HoldNoteScore );
|
||||||
XToThemedString( HoldNoteScore, NUM_HOLD_NOTE_SCORES );
|
XToThemedString( HoldNoteScore, NUM_HOLD_NOTE_SCORES );
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ static const CString MemoryCardStateNames[NUM_MEMORY_CARD_STATES] = {
|
|||||||
"removed",
|
"removed",
|
||||||
"none",
|
"none",
|
||||||
};
|
};
|
||||||
XToString( MemoryCardState );
|
XToString( MemoryCardState, NUM_MEMORY_CARD_STATES );
|
||||||
|
|
||||||
|
|
||||||
static const CString PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = {
|
static const CString PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = {
|
||||||
@@ -170,7 +170,7 @@ static const CString PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = {
|
|||||||
"Greats90Percent",
|
"Greats90Percent",
|
||||||
"Greats100Percent",
|
"Greats100Percent",
|
||||||
};
|
};
|
||||||
XToString( PerDifficultyAward );
|
XToString( PerDifficultyAward, NUM_PER_DIFFICULTY_AWARDS );
|
||||||
XToThemedString( PerDifficultyAward, NUM_PER_DIFFICULTY_AWARDS );
|
XToThemedString( PerDifficultyAward, NUM_PER_DIFFICULTY_AWARDS );
|
||||||
StringToX( PerDifficultyAward );
|
StringToX( PerDifficultyAward );
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ static const CString PeakComboAwardNames[NUM_PEAK_COMBO_AWARDS] = {
|
|||||||
"Peak9000Combo",
|
"Peak9000Combo",
|
||||||
"Peak10000Combo",
|
"Peak10000Combo",
|
||||||
};
|
};
|
||||||
XToString( PeakComboAward );
|
XToString( PeakComboAward, NUM_PEAK_COMBO_AWARDS );
|
||||||
XToThemedString( PeakComboAward, NUM_PEAK_COMBO_AWARDS );
|
XToThemedString( PeakComboAward, NUM_PEAK_COMBO_AWARDS );
|
||||||
StringToX( PeakComboAward );
|
StringToX( PeakComboAward );
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ static const CString StyleTypeNames[NUM_STYLE_TYPES] = {
|
|||||||
"TwoPlayersTwoSides",
|
"TwoPlayersTwoSides",
|
||||||
"OnePlayerTwoSides",
|
"OnePlayerTwoSides",
|
||||||
};
|
};
|
||||||
XToString( StyleType );
|
XToString( StyleType, NUM_STYLE_TYPES );
|
||||||
StringToX( StyleType );
|
StringToX( StyleType );
|
||||||
|
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ static const CString MenuDirNames[NUM_MENU_DIRS] = {
|
|||||||
"Right",
|
"Right",
|
||||||
"Auto",
|
"Auto",
|
||||||
};
|
};
|
||||||
XToString( MenuDir );
|
XToString( MenuDir, NUM_MENU_DIRS );
|
||||||
|
|
||||||
|
|
||||||
static const CString GoalTypeNames[NUM_GOAL_TYPES] = {
|
static const CString GoalTypeNames[NUM_GOAL_TYPES] = {
|
||||||
@@ -280,7 +280,7 @@ static const CString GoalTypeNames[NUM_GOAL_TYPES] = {
|
|||||||
"Time",
|
"Time",
|
||||||
"None",
|
"None",
|
||||||
};
|
};
|
||||||
XToString( GoalType );
|
XToString( GoalType, NUM_GOAL_TYPES );
|
||||||
StringToX( GoalType );
|
StringToX( GoalType );
|
||||||
static void LuaGoalType(lua_State* L)
|
static void LuaGoalType(lua_State* L)
|
||||||
{
|
{
|
||||||
@@ -301,7 +301,7 @@ static const CString EditMenuActionNames[NUM_EDIT_MENU_ACTIONS] = {
|
|||||||
"Autogen",
|
"Autogen",
|
||||||
"Blank"
|
"Blank"
|
||||||
};
|
};
|
||||||
XToString( EditMenuAction );
|
XToString( EditMenuAction, NUM_EDIT_MENU_ACTIONS );
|
||||||
XToThemedString( EditMenuAction, NUM_EDIT_MENU_ACTIONS );
|
XToThemedString( EditMenuAction, NUM_EDIT_MENU_ACTIONS );
|
||||||
StringToX( EditMenuAction );
|
StringToX( EditMenuAction );
|
||||||
static void LuaEditMenuAction(lua_State* L)
|
static void LuaEditMenuAction(lua_State* L)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ static const CString CabinetLightNames[NUM_CABINET_LIGHTS] = {
|
|||||||
"BassLeft",
|
"BassLeft",
|
||||||
"BassRight",
|
"BassRight",
|
||||||
};
|
};
|
||||||
XToString( CabinetLight );
|
XToString( CabinetLight, NUM_CABINET_LIGHTS );
|
||||||
|
|
||||||
static const CString LightsModeNames[NUM_LIGHTS_MODES] = {
|
static const CString LightsModeNames[NUM_LIGHTS_MODES] = {
|
||||||
"Attract",
|
"Attract",
|
||||||
@@ -32,7 +32,7 @@ static const CString LightsModeNames[NUM_LIGHTS_MODES] = {
|
|||||||
"Cleared",
|
"Cleared",
|
||||||
"Test",
|
"Test",
|
||||||
};
|
};
|
||||||
XToString( LightsMode );
|
XToString( LightsMode, NUM_LIGHTS_MODES );
|
||||||
|
|
||||||
|
|
||||||
LightsManager* LIGHTSMAN = NULL; // global and accessable from anywhere in our program
|
LightsManager* LIGHTSMAN = NULL; // global and accessable from anywhere in our program
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ static const CString MessageNames[NUM_MESSAGES] = {
|
|||||||
"EditSourceStepsChanged",
|
"EditSourceStepsChanged",
|
||||||
"EditSourceStepsTypeChanged",
|
"EditSourceStepsTypeChanged",
|
||||||
};
|
};
|
||||||
XToString( Message );
|
XToString( Message, NUM_MESSAGES );
|
||||||
|
|
||||||
|
|
||||||
MessageManager::MessageManager()
|
MessageManager::MessageManager()
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ static const CString SelectTypeNames[NUM_SELECT_TYPES] = {
|
|||||||
"SelectMultiple",
|
"SelectMultiple",
|
||||||
"SelectNone",
|
"SelectNone",
|
||||||
};
|
};
|
||||||
XToString( SelectType );
|
XToString( SelectType, NUM_SELECT_TYPES );
|
||||||
StringToX( SelectType );
|
StringToX( SelectType );
|
||||||
|
|
||||||
static const CString LayoutTypeNames[NUM_LAYOUT_TYPES] = {
|
static const CString LayoutTypeNames[NUM_LAYOUT_TYPES] = {
|
||||||
"ShowAllInRow",
|
"ShowAllInRow",
|
||||||
"ShowOneInRow",
|
"ShowOneInRow",
|
||||||
};
|
};
|
||||||
XToString( LayoutType );
|
XToString( LayoutType, NUM_LAYOUT_TYPES );
|
||||||
StringToX( LayoutType );
|
StringToX( LayoutType );
|
||||||
|
|
||||||
#define FOREACH_OptionsPlayer( pn ) \
|
#define FOREACH_OptionsPlayer( pn ) \
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ static const CString PrefsGroupNames[NUM_PREFS_GROUPS] = {
|
|||||||
"Editor",
|
"Editor",
|
||||||
"Options",
|
"Options",
|
||||||
};
|
};
|
||||||
XToString( PrefsGroup );
|
XToString( PrefsGroup, NUM_PREFS_GROUPS );
|
||||||
|
|
||||||
IPreference::IPreference( PrefsGroup PrefsGroup, const CString& sName ):
|
IPreference::IPreference( PrefsGroup PrefsGroup, const CString& sName ):
|
||||||
m_PrefsGroup( PrefsGroup ),
|
m_PrefsGroup( PrefsGroup ),
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ static const CString PageTypeNames[NUM_PAGE_TYPES] = {
|
|||||||
"AllSteps",
|
"AllSteps",
|
||||||
"AllCourses",
|
"AllCourses",
|
||||||
};
|
};
|
||||||
XToString( PageType );
|
XToString( PageType, NUM_PAGE_TYPES );
|
||||||
|
|
||||||
|
|
||||||
#define COURSES_TO_SHOW PREFSMAN->m_sCoursesToShowRanking
|
#define COURSES_TO_SHOW PREFSMAN->m_sCoursesToShowRanking
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ static const CString SetTimeSelectionNames[NUM_SET_TIME_SELECTIONS] = {
|
|||||||
"Minute",
|
"Minute",
|
||||||
"Second",
|
"Second",
|
||||||
};
|
};
|
||||||
XToString( SetTimeSelection );
|
XToString( SetTimeSelection, NUM_SET_TIME_SELECTIONS );
|
||||||
#define FOREACH_SetTimeSelection( s ) FOREACH_ENUM( SetTimeSelection, NUM_SET_TIME_SELECTIONS, s )
|
#define FOREACH_SetTimeSelection( s ) FOREACH_ENUM( SetTimeSelection, NUM_SET_TIME_SELECTIONS, s )
|
||||||
|
|
||||||
const float g_X[NUM_SET_TIME_SELECTIONS] =
|
const float g_X[NUM_SET_TIME_SELECTIONS] =
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ static const CString ElementCategoryNames[NUM_ELEMENT_CATEGORIES] = {
|
|||||||
"Sounds",
|
"Sounds",
|
||||||
"Other"
|
"Other"
|
||||||
};
|
};
|
||||||
XToString( ElementCategory );
|
XToString( ElementCategory, NUM_ELEMENT_CATEGORIES );
|
||||||
StringToX( ElementCategory );
|
StringToX( ElementCategory );
|
||||||
static void LuaElementCategory(lua_State* L)
|
static void LuaElementCategory(lua_State* L)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ static CString UnlockTypeNames[NUM_UNLOCK_TYPES] =
|
|||||||
"Toasties",
|
"Toasties",
|
||||||
"StagesCleared"
|
"StagesCleared"
|
||||||
};
|
};
|
||||||
XToString(UnlockType);
|
XToString( UnlockType, NUM_UNLOCK_TYPES );
|
||||||
StringToX( UnlockType );
|
StringToX( UnlockType );
|
||||||
|
|
||||||
UnlockManager::UnlockManager()
|
UnlockManager::UnlockManager()
|
||||||
|
|||||||
Reference in New Issue
Block a user