add metric to enable/disable name blacklist
This commit is contained in:
@@ -4429,3 +4429,6 @@ Answer3Of3Y=SCREEN_CENTER_Y+120
|
|||||||
Answer3Of3OnCommand=
|
Answer3Of3OnCommand=
|
||||||
Answer3Of3OffCommand=
|
Answer3Of3OffCommand=
|
||||||
Answer3Of3Text=CANCEL
|
Answer3Of3Text=CANCEL
|
||||||
|
|
||||||
|
[GameState]
|
||||||
|
UseNameBlacklist=0
|
||||||
+22
-19
@@ -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,29 +1606,30 @@ 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();
|
||||||
RageFile file;
|
|
||||||
if( file.Open(NAMES_BLACKLIST_FILE) )
|
if( USE_NAME_BLACKLIST )
|
||||||
{
|
{
|
||||||
CString line;
|
RageFile file;
|
||||||
|
if( file.Open(NAME_BLACKLIST_FILE) )
|
||||||
while (!file.AtEOF())
|
|
||||||
{
|
{
|
||||||
if( file.GetLine( line ) == -1 )
|
CString line;
|
||||||
{
|
|
||||||
LOG->Warn( "Error reading \"%s\": %s", NAMES_BLACKLIST_FILE, file.GetError().c_str() );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
line.MakeUpper();
|
while (!file.AtEOF())
|
||||||
if( !line.empty() && name.Find(line) != -1 ) // name contains a bad word
|
|
||||||
{
|
{
|
||||||
LOG->Trace( "entered '%s' matches blacklisted item '%s'", name.c_str(), line.c_str() );
|
if( file.GetLine( line ) == -1 )
|
||||||
name = "";
|
{
|
||||||
break;
|
LOG->Warn( "Error reading \"%s\": %s", NAME_BLACKLIST_FILE, file.GetError().c_str() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
line.MakeUpper();
|
||||||
|
if( !line.empty() && name.Find(line) != -1 ) // name contains a bad word
|
||||||
|
{
|
||||||
|
LOG->Trace( "entered '%s' matches blacklisted item '%s'", name.c_str(), line.c_str() );
|
||||||
|
name = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user