Add a config var to toggle colors enablement for the console output

This commit is contained in:
Alexander Akulich 2021-12-08 18:50:44 +03:00
parent fa977bbdce
commit cad00f7ce1
2 changed files with 9 additions and 5 deletions

View file

@ -12,6 +12,7 @@ MACRO_CONFIG_INT(PlayerCountry, player_country, -1, -1, 1000, CFGFLAG_SAVE | CFG
MACRO_CONFIG_STR(Password, password, 32, "", CFGFLAG_CLIENT | CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, "Password to the server")
MACRO_CONFIG_STR(Logfile, logfile, 128, "", CFGFLAG_SAVE | CFGFLAG_CLIENT | CFGFLAG_SERVER, "Filename to log all output to")
MACRO_CONFIG_INT(ConsoleOutputLevel, console_output_level, 0, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SERVER, "Adjusts the amount of information in the console")
MACRO_CONFIG_INT(ConsoleEnableColors, console_enable_colors, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SERVER, "Enable colors in console output")
MACRO_CONFIG_INT(Events, events, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT | CFGFLAG_SERVER, "Enable triggering of events, (eye emotes on some holidays in server, christmas skins in client).")
MACRO_CONFIG_STR(SteamName, steam_name, 16, "", CFGFLAG_SAVE | CFGFLAG_CLIENT, "Last seen name of the Steam profile")

View file

@ -315,11 +315,14 @@ char *CConsole::Format(char *pBuf, int Size, const char *pFrom, const char *pStr
void CConsole::Print(int Level, const char *pFrom, const char *pStr, ColorRGBA PrintColor)
{
// if the color is pure white, use default terminal color
if(mem_comp(&PrintColor, &gs_ConsoleDefaultColor, sizeof(ColorRGBA)) == 0)
set_console_msg_color(NULL);
else
set_console_msg_color(&PrintColor);
if(g_Config.m_ConsoleEnableColors)
{
// if the color is pure white, use default terminal color
if(mem_comp(&PrintColor, &gs_ConsoleDefaultColor, sizeof(ColorRGBA)) == 0)
set_console_msg_color(NULL);
else
set_console_msg_color(&PrintColor);
}
dbg_msg(pFrom, "%s", pStr);
set_console_msg_color(NULL);
char aBuf[1024];