@@ -79,7 +79,6 @@ CMainConfig::CMainConfig ( CConsole* pConsole, CLuaManager* pLuaMain ): CXMLConf
7979 m_iHTTPThreadCount = 8 ;
8080 m_iHTTPDosThreshold = 20 ;
8181 m_iEnableClientChecks = -1 ;
82- m_bAutoUpdateAntiCheatEnabled = true ;
8382 m_bJoinFloodProtectionEnabled = true ;
8483 m_bScriptDebugLogEnabled = false ;
8584 m_uiScriptDebugLogLevel = 0 ;
@@ -299,9 +298,8 @@ bool CMainConfig::Load ( void )
299298 {
300299 SString strDisableAC;
301300 GetString ( m_pRootNode, " disableac" , strDisableAC );
302- strDisableAC = strDisableAC.Replace ( " " , " " );
303301 std::vector < SString > tagACList;
304- strDisableAC. Split ( " , " , tagACList );
302+ ReadCommaSeparatedList (strDisableAC, tagACList);
305303 for ( std::vector < SString >::iterator it = tagACList.begin () ; it != tagACList.end () ; ++it )
306304 if ( isdigit ((uchar)***it) )
307305 {
@@ -320,9 +318,8 @@ bool CMainConfig::Load ( void )
320318 {
321319 SString strEnableSD;
322320 GetString ( m_pRootNode, " enablesd" , strEnableSD );
323- strEnableSD = strEnableSD.Replace ( " " , " " );
324321 std::vector < SString > tagSDList;
325- strEnableSD. Split ( " , " , tagSDList );
322+ ReadCommaSeparatedList (strEnableSD, tagSDList);
326323 for ( std::vector < SString >::iterator it = tagSDList.begin () ; it != tagSDList.end () ; ++it )
327324 if ( isdigit ((uchar)***it) )
328325 {
@@ -355,12 +352,9 @@ bool CMainConfig::Load ( void )
355352 {
356353 SString strEnable;
357354 GetString ( m_pRootNode, " enable_diagnostic" , strEnable );
358- strEnable = strEnable.Replace ( " " , " " );
359355 std::vector < SString > tagList;
360- strEnable.Split ( " ," , tagList );
361- for ( std::vector < SString >::iterator it = tagList.begin () ; it != tagList.end () ; ++it )
362- if ( (*it).length () )
363- MapInsert ( m_EnableDiagnosticMap, *it );
356+ ReadCommaSeparatedList (strEnable, tagList);
357+ m_EnableDiagnosticMap = std::set<SString>(tagList.begin (), tagList.end ());
364358 }
365359
366360 // Grab the server password
@@ -508,16 +502,7 @@ bool CMainConfig::Load ( void )
508502 // If not defined in conf file, then default to disabled
509503 strGroupList = " " ;
510504 }
511- strGroupList.Split ( " ," , m_AuthSerialGroupList );
512- for ( auto iter = m_AuthSerialGroupList.begin () ; iter != m_AuthSerialGroupList.end () ; )
513- {
514- SString& strGroup = *iter;
515- strGroup = strGroup.TrimEnd ( " " ).TrimStart ( " " );
516- if ( strGroup.empty () )
517- iter = m_AuthSerialGroupList.erase ( iter );
518- else
519- ++iter;
520- }
505+ ReadCommaSeparatedList (strGroupList, m_AuthSerialGroupList);
521506
522507 // auth_serial_http
523508 if ( GetBoolean ( m_pRootNode, " auth_serial_http" , m_bAuthSerialHttpEnabled ) != IS_SUCCESS )
@@ -1351,11 +1336,11 @@ bool CMainConfig::SetSetting ( const SString& strName, const SString& strValue,
13511336 SString strCurSD;
13521337 GetSetting ( " enablesd" , strCurSD );
13531338 std::vector < SString > curSDList;
1354- strCurSD. Replace ( " " , " " ). Split ( " , " , curSDList );
1339+ ReadCommaSeparatedList (strCurSD, curSDList);
13551340
13561341 // Get new setting as as list of ids
13571342 std::vector < SString > newSDList;
1358- strValue. Replace ( " " , " " ). Split ( " , " , newSDList );
1343+ ReadCommaSeparatedList (strValue, newSDList);
13591344
13601345 // Merge
13611346 std::set < uint > comboSDMap;
@@ -1387,17 +1372,13 @@ bool CMainConfig::SetSetting ( const SString& strName, const SString& strValue,
13871372 {
13881373 if ( true )
13891374 {
1390- m_EnableDiagnosticMap.clear ();
1391- SString strEnableDiagnostic = strValue.Replace ( " " , " " );
13921375 std::vector < SString > tagList;
1393- strEnableDiagnostic.Split ( " ," , tagList );
1394- for ( std::vector < SString >::iterator it = tagList.begin () ; it != tagList.end () ; ++it )
1395- if ( (*it).length () )
1396- MapInsert ( m_EnableDiagnosticMap, *it );
1376+ ReadCommaSeparatedList (strValue, tagList);
1377+ m_EnableDiagnosticMap = std::set<SString>(tagList.begin (), tagList.end ());
13971378
13981379 if ( bSave )
13991380 {
1400- SetString ( m_pRootNode, " enable_diagnostic" , strEnableDiagnostic );
1381+ SetString ( m_pRootNode, " enable_diagnostic" , SString::Join ( " , " , tagList) );
14011382 Save ();
14021383 }
14031384 return true ;
0 commit comments