Don't define CStrings in headers. A new instance will be created in every

file that uses the header.  A string in GameConstantsAndTypes.h may be duplicated
dozens of times; since it's not a POD, the compiler can't omit or merge it.
This commit is contained in:
Glenn Maynard
2005-06-09 04:03:08 +00:00
parent 4cbef95dcb
commit 6be07b3d5d
6 changed files with 39 additions and 20 deletions
+11
View File
@@ -13,6 +13,17 @@ const CString BG_ANIMS_DIR = "BGAnimations/";
const CString VISUALIZATIONS_DIR = "Visualizations/";
const CString RANDOMMOVIES_DIR = "RandomMovies/";
const CString RANDOM_BACKGROUND_FILE = "-random-";
const CString NO_SONG_BG_FILE = "-nosongbg-";
const CString SONG_BACKGROUND_FILE = "songbackground";
const CString SBE_UpperLeft = "UpperLeft";
const CString SBE_Centered = "Centered";
const CString SBE_StretchNormal = "StretchNormal";
const CString SBE_StretchNoLoop = "StretchNoLoop";
const CString SBE_StretchRewind = "StretchRewind";
const CString SBT_CrossFade = "CrossFade";
static void StripCvs( vector<CString> &vsPathsToStrip, vector<CString> &vsNamesToStrip )
{
ASSERT( vsPathsToStrip.size() == vsNamesToStrip.size() );
+9 -9
View File
@@ -5,16 +5,16 @@
class Song;
const CString SBE_UpperLeft = "UpperLeft";
const CString SBE_Centered = "Centered";
const CString SBE_StretchNormal = "StretchNormal";
const CString SBE_StretchNoLoop = "StretchNoLoop";
const CString SBE_StretchRewind = "StretchRewind";
const CString SBT_CrossFade = "CrossFade";
extern const CString RANDOM_BACKGROUND_FILE;
extern const CString NO_SONG_BG_FILE;
extern const CString SONG_BACKGROUND_FILE;
const CString RANDOM_BACKGROUND_FILE = "-random-";
const CString NO_SONG_BG_FILE = "-nosongbg-";
const CString SONG_BACKGROUND_FILE = "songbackground";
extern const CString SBE_UpperLeft;
extern const CString SBE_Centered;
extern const CString SBE_StretchNormal;
extern const CString SBE_StretchNoLoop;
extern const CString SBE_StretchRewind;
extern const CString SBT_CrossFade;
struct BackgroundDef
{
+1
View File
@@ -17,6 +17,7 @@ LuaFunction( X##ToString, X##ToString( (X) IArg(1) ) );
#define LuaStringToX(X) \
LuaFunction( StringTo##X, (X) StringTo##X( SArg(1) ) );
const CString RANKING_TO_FILL_IN_MARKER[NUM_PLAYERS] = {"#P1#","#P2#"};
static const CString RadarCategoryNames[] = {
"Stream",
+1 -1
View File
@@ -204,7 +204,7 @@ enum RankingCategory
const CString& RankingCategoryToString( RankingCategory rc );
RankingCategory StringToRankingCategory( const CString& rc );
const CString RANKING_TO_FILL_IN_MARKER[NUM_PLAYERS] = {"#P1#","#P2#"};
extern const CString RANKING_TO_FILL_IN_MARKER[NUM_PLAYERS];
inline bool IsRankingToFillIn( const CString& sName ) { return !sName.empty() && sName[0]=='#'; }
RankingCategory AverageMeterToRankingCategory( int iAverageMeter );
+9 -2
View File
@@ -27,8 +27,15 @@
//
// Old file versions for backward compatibility
//
const CString STATS_XSL = "Stats.xsl";
const CString COMMON_XSL = "Common.xsl";
const CString STATS_XSL = "Stats.xsl";
const CString COMMON_XSL = "Common.xsl";
const CString STATS_XML = "Stats.xml";
const CString EDITABLE_INI = "Editable.ini";
const CString DONT_SHARE_SIG = "DontShare.sig";
const CString PUBLIC_KEY_FILE = "public.key";
const CString SCREENSHOTS_SUBDIR = "Screenshots/";
const CString EDITS_SUBDIR = "Edits/";
const CString LASTGOOD_SUBDIR = "LastGood/";
#define GUID_SIZE_BYTES 8
+8 -8
View File
@@ -23,15 +23,16 @@ struct lua_State;
//
// Current file versions
//
const CString STATS_XML = "Stats.xml";
extern const CString STATS_XML;
extern const CString EDITABLE_INI;
const CString EDITABLE_INI = "Editable.ini";
// Editable data is an INI because the default INI file association on Windows
// systems will open the ini file in an editor. The default association for
// XML will open in IE. Users have a much better chance of discovering how to
// edit this data if they don't have to fight against the file associations.
extern const CString DONT_SHARE_SIG;
const CString DONT_SHARE_SIG = "DontShare.sig";
// The "don't share" file is something that the user should always keep private.
// They can safely share STATS_XML with STATS_XML's signature so that others
// can authenticate the STATS_XML data. However, others can't copy that data
@@ -39,11 +40,10 @@ const CString DONT_SHARE_SIG = "DontShare.sig";
// share" file. DontShare contains a piece of information that we can
// construct using STATS_XML but the user can't construct using STATS_XML.
// The file contains a signature of the STATS_XML's signature.
const CString PUBLIC_KEY_FILE = "public.key";
const CString SCREENSHOTS_SUBDIR = "Screenshots/";
const CString EDITS_SUBDIR = "Edits/";
const CString LASTGOOD_SUBDIR = "LastGood/";
extern const CString PUBLIC_KEY_FILE;
extern const CString SCREENSHOTS_SUBDIR;
extern const CString EDITS_SUBDIR;
extern const CString LASTGOOD_SUBDIR;
class Style;