cache XToThemedString

This commit is contained in:
Glenn Maynard
2005-02-02 06:53:31 +00:00
parent 467c88c59b
commit 544820e8cd
3 changed files with 20 additions and 13 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "Difficulty.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "ThemeMetric.h"
static const CString DifficultyNames[NUM_DIFFICULTIES] = {
@@ -13,7 +13,7 @@ static const CString DifficultyNames[NUM_DIFFICULTIES] = {
"Edit",
};
XToString( Difficulty );
XToThemedString( Difficulty );
XToThemedString( Difficulty, NUM_DIFFICULTIES );
/* We prefer the above names; recognize a number of others, too. (They'l
* get normalized when written to SMs, etc.) */
@@ -52,7 +52,7 @@ static const CString CourseDifficultyNames[NUM_DIFFICULTIES] =
"(not used)",
};
XToString( CourseDifficulty );
XToThemedString( CourseDifficulty );
XToThemedString( CourseDifficulty, NUM_DIFFICULTIES );
StringToX( CourseDifficulty );
CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd )
+10 -3
View File
@@ -46,10 +46,17 @@ static const CString EMPTY_STRING;
return X##Names[x]; \
}
#define XToThemedString(X) \
#define XToThemedString(X, CNT) \
static ThemeMetric<CString> g_##X##Name[CNT]; \
CString X##ToThemedString( X x ) \
{ \
return THEME->GetMetric( #X, X##ToString(x) ); \
{ \
static bool bInitted = false; \
if( !bInitted ) { \
bInitted = true; \
for( unsigned i = 0; i < CNT; ++i ) \
g_##X##Name[i].Load( #X, X##ToString((X)i) ); \
} \
return g_##X##Name[x]; \
}
#define StringToX(X) \
+7 -7
View File
@@ -2,7 +2,7 @@
#include "GameConstantsAndTypes.h"
#include "GameState.h"
#include "RageUtil.h"
#include "ThemeManager.h"
#include "ThemeMetric.h"
#include "EnumHelper.h"
#include "Foreach.h"
#include "PrefsManager.h"
@@ -21,7 +21,7 @@ static const CString RadarCategoryNames[NUM_RADAR_CATEGORIES] = {
"Hands",
};
XToString( RadarCategory );
XToThemedString( RadarCategory );
XToThemedString( RadarCategory, NUM_RADAR_CATEGORIES );
static const CString PlayModeNames[NUM_PLAY_MODES] = {
@@ -33,7 +33,7 @@ static const CString PlayModeNames[NUM_PLAY_MODES] = {
"Rave",
};
XToString( PlayMode );
XToThemedString( PlayMode );
XToThemedString( PlayMode, NUM_PLAY_MODES );
StringToX( PlayMode );
@@ -107,7 +107,7 @@ static const CString TapNoteScoreNames[NUM_TAP_NOTE_SCORES] = {
};
XToString( TapNoteScore );
StringToX( TapNoteScore );
XToThemedString( TapNoteScore );
XToThemedString( TapNoteScore, NUM_TAP_NOTE_SCORES );
static const CString HoldNoteScoreNames[NUM_HOLD_NOTE_SCORES] = {
@@ -117,7 +117,7 @@ static const CString HoldNoteScoreNames[NUM_HOLD_NOTE_SCORES] = {
};
XToString( HoldNoteScore );
StringToX( HoldNoteScore );
XToThemedString( HoldNoteScore );
XToThemedString( HoldNoteScore, NUM_HOLD_NOTE_SCORES );
static const CString MemoryCardStateNames[NUM_MEMORY_CARD_STATES] = {
@@ -142,7 +142,7 @@ static const CString PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = {
"Greats100Percent",
};
XToString( PerDifficultyAward );
XToThemedString( PerDifficultyAward );
XToThemedString( PerDifficultyAward, NUM_PER_DIFFICULTY_AWARDS );
StringToX( PerDifficultyAward );
@@ -163,7 +163,7 @@ static const CString PeakComboAwardNames[NUM_PEAK_COMBO_AWARDS] = {
"Peak10000Combo",
};
XToString( PeakComboAward );
XToThemedString( PeakComboAward );
XToThemedString( PeakComboAward, NUM_PEAK_COMBO_AWARDS );
StringToX( PeakComboAward );