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