# HG changeset patch # User Adam Kaminski # Date 1623262794 14400 # Wed Jun 09 14:19:54 2021 -0400 # Node ID e838e26732e2f9cbff436ba5a957c8c37a9429f8 # Parent d643ec9279eea6f0740fb562eac715b60f5dc834 Any color codes used in sv_hostname are now removed before sending it to the master server, or wherever it's used in the server console window. diff -r d643ec9279ee -r e838e26732e2 src/sv_master.cpp --- a/src/sv_master.cpp Wed Jun 02 00:25:42 2021 -0400 +++ b/src/sv_master.cpp Wed Jun 09 14:19:54 2021 -0400 @@ -70,6 +70,7 @@ #include "sv_ban.h" #include "version.h" #include "d_dehacked.h" +#include "v_text.h" //-------------------------------------------------------------------------------------------------------------------------------------------------- //-- VARIABLES ------------------------------------------------------------------------------------------------------------------------------------- @@ -382,7 +383,14 @@ // Send the server name. if ( ulBits & SQF_NAME ) - g_MasterServerBuffer.ByteStream.WriteString( sv_hostname ); + { + // [AK] Remove any color codes in the server name first. + FString uncolorizedHostname = sv_hostname.GetGenericRep( CVAR_String ).String; + V_ColorizeString( uncolorizedHostname ); + V_RemoveColorCodes( uncolorizedHostname ); + + g_MasterServerBuffer.ByteStream.WriteString( uncolorizedHostname ); + } // Send the website URL. if ( ulBits & SQF_URL ) diff -r d643ec9279ee -r e838e26732e2 src/win32/serverconsole/serverconsole.cpp --- a/src/win32/serverconsole/serverconsole.cpp Wed Jun 02 00:25:42 2021 -0400 +++ b/src/win32/serverconsole/serverconsole.cpp Wed Jun 09 14:19:54 2021 -0400 @@ -1620,10 +1620,13 @@ if ( !g_bServerLoaded ) return; - char szString[256]; - strncpy( szString, pszString, 255 ); - SetDlgItemText( g_hDlg, IDC_TITLEBOX, szString ); - SetWindowText( g_hDlg, szString ); + // [AK] Remove any color codes in the string first. + FString titleString = pszString; + V_ColorizeString( titleString ); + V_RemoveColorCodes( titleString ); + + SetDlgItemText( g_hDlg, IDC_TITLEBOX, titleString ); + SetWindowText( g_hDlg, titleString ); } //*****************************************************************************