From f97876d9cf0faf8acd20b416efc6835641a8e15f Mon Sep 17 00:00:00 2001 From: jeefo Date: Tue, 28 May 2024 09:09:54 +0300 Subject: [PATCH] conf: remove yb_logger_disable_logfile in favor of custom setting --- cfg/addons/yapb/conf/custom.cfg | 5 +++++ cfg/addons/yapb/conf/yapb.cfg | 7 ------- src/config.cpp | 30 ++++++++++++++++++++---------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/cfg/addons/yapb/conf/custom.cfg b/cfg/addons/yapb/conf/custom.cfg index 6e6a33a..f055834 100644 --- a/cfg/addons/yapb/conf/custom.cfg +++ b/cfg/addons/yapb/conf/custom.cfg @@ -58,3 +58,8 @@ ZMInfectedTeam = T ; EnableFakeBotFeatures = no +; +; Disables any writing activity to log files. Thus all errors and warnings just +; sent to the server console. This replaces yb_logger_disable_logfile cvar. +; +DisableLogFile = no diff --git a/cfg/addons/yapb/conf/yapb.cfg b/cfg/addons/yapb/conf/yapb.cfg index 7e929aa..7a8fb07 100644 --- a/cfg/addons/yapb/conf/yapb.cfg +++ b/cfg/addons/yapb/conf/yapb.cfg @@ -312,13 +312,6 @@ yb_bind_menu_key "=" // yb_ignore_cvars_on_changelevel "yb_quota,yb_autovacate" -// -// Disables logger to write anything to log file. Just spew content to the console. -// --- -// Default: "0", Min: "0", Max: "1" -// -yb_logger_disable_logfile "0" - // // The value (password) for the setinfo key, if user sets correct password, he's gains access to bot commands and menus. // --- diff --git a/src/config.cpp b/src/config.cpp index 9066531..e5901a9 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -9,7 +9,6 @@ ConVar cv_bind_menu_key ("bind_menu_key", "=", "Binds specified key for opening bots menu.", false); ConVar cv_ignore_cvars_on_changelevel ("ignore_cvars_on_changelevel", "yb_quota,yb_autovacate", "Specifies comma separated list of bot cvars, that will not be overwritten by config on changelevel.", false); -ConVar cv_logger_disable_logfile ("logger_disable_logfile", "0", "Disables logger to write anything to log file. Just spew content to the console."); BotConfig::BotConfig () { m_chat.resize (Chat::Count); @@ -106,6 +105,9 @@ void BotConfig::loadMainConfig (bool isFirstLoad) { cv_difficulty.set (3); } + // preload custom config + conf.loadCustomConfig (); + // bind the correct menu key for bot menu... if (!game.isDedicated ()) { auto val = cv_bind_menu_key.as (); @@ -114,9 +116,14 @@ void BotConfig::loadMainConfig (bool isFirstLoad) { game.serverCommand ("bind \"%s\" \"yb menu\"", val); } } + static const bool disableLogWrite = conf.fetchCustom ("DisableLogFile").startsWith ("yes"); // disable logger if requested - logger.disableLogWrite (cv_logger_disable_logfile); + logger.disableLogWrite (disableLogWrite); + + if (disableLogWrite) { + game.print ("Bot logging is disabled."); + } } void BotConfig::loadNamesConfig () { @@ -671,14 +678,17 @@ void BotConfig::loadCustomConfig () { MemFile file {}; auto setDefaults = [&] () { - m_custom["C4ModelName"] = "c4.mdl"; - m_custom["AMXParachuteCvar"] = "sv_parachute"; - m_custom["CustomCSDMSpawnPoint"] = "view_spawn"; - m_custom["CSDMDetectCvar"] = "csdm_active"; - m_custom["ZMDetectCvar"] = "zp_delay"; - m_custom["ZMDelayCvar"] = "zp_delay"; - m_custom["ZMInfectedTeam"] = "T"; - m_custom["EnableFakeBotFeatures"] = "no"; + m_custom = { + { "C4ModelName", "c4.mdl" }, + { "AMXParachuteCvar", "sv_parachute" }, + { "CustomCSDMSpawnPoint", "view_spawn" }, + { "CSDMDetectCvar", "csdm_active" }, + { "ZMDetectCvar", "zp_delay" }, + { "ZMDelayCvar", "zp_delay" }, + { "ZMInfectedTeam", "T" }, + { "EnableFakeBotFeatures", "no" }, + { "DisableLogFile", "no" } + }; }; setDefaults ();