add metric to enable/disable name blacklist

This commit is contained in:
Chris Danford
2005-04-03 06:48:26 +00:00
parent 134cdb4451
commit 2017e310ef
2 changed files with 27 additions and 21 deletions
+3
View File
@@ -4429,3 +4429,6 @@ Answer3Of3Y=SCREEN_CENTER_Y+120
Answer3Of3OnCommand= Answer3Of3OnCommand=
Answer3Of3OffCommand= Answer3Of3OffCommand=
Answer3Of3Text=CANCEL Answer3Of3Text=CANCEL
[GameState]
UseNameBlacklist=0
+9 -6
View File
@@ -42,7 +42,9 @@
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
#define CHARACTERS_DIR "Characters/" #define CHARACTERS_DIR "Characters/"
#define NAMES_BLACKLIST_FILE "Data/NamesBlacklist.dat" #define NAME_BLACKLIST_FILE "Data/NamesBlacklist.dat"
ThemeMetric<bool> USE_NAME_BLACKLIST("GameState","UseNameBlacklist");
GameState::GameState() : GameState::GameState() :
m_PreferredCourseDifficulty( MESSAGE_EDIT_PREFERRED_COURSE_DIFFICULTY_P1_CHANGED ), m_PreferredCourseDifficulty( MESSAGE_EDIT_PREFERRED_COURSE_DIFFICULTY_P1_CHANGED ),
@@ -1604,12 +1606,12 @@ bool GameState::AnyPlayerHasRankingFeats() const
void GameState::StoreRankingName( PlayerNumber pn, CString name ) void GameState::StoreRankingName( PlayerNumber pn, CString name )
{ {
//
// Filter swear words from name
//
name.MakeUpper(); name.MakeUpper();
if( USE_NAME_BLACKLIST )
{
RageFile file; RageFile file;
if( file.Open(NAMES_BLACKLIST_FILE) ) if( file.Open(NAME_BLACKLIST_FILE) )
{ {
CString line; CString line;
@@ -1617,7 +1619,7 @@ void GameState::StoreRankingName( PlayerNumber pn, CString name )
{ {
if( file.GetLine( line ) == -1 ) if( file.GetLine( line ) == -1 )
{ {
LOG->Warn( "Error reading \"%s\": %s", NAMES_BLACKLIST_FILE, file.GetError().c_str() ); LOG->Warn( "Error reading \"%s\": %s", NAME_BLACKLIST_FILE, file.GetError().c_str() );
break; break;
} }
@@ -1630,6 +1632,7 @@ void GameState::StoreRankingName( PlayerNumber pn, CString name )
} }
} }
} }
}
vector<RankingFeat> aFeats; vector<RankingFeat> aFeats;
GetRankingFeats( pn, aFeats ); GetRankingFeats( pn, aFeats );