From f39792f33077ff06d27041887ccc3b757119fc6f Mon Sep 17 00:00:00 2001 From: furo Date: Mon, 9 Oct 2023 00:53:28 +0200 Subject: [PATCH] Show correct max length in help text for `MACRO_CONFIG_STR` --- src/engine/shared/console.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp index eda02ee33..9e2b9629e 100644 --- a/src/engine/shared/console.cpp +++ b/src/engine/shared/console.cpp @@ -1041,7 +1041,9 @@ void CConsole::Init() { \ static char s_aOldValue[Len] = Def; \ static CStrVariableData Data = {this, g_Config.m_##Name, Len, s_aOldValue}; \ - Register(#ScriptName, "?r", Flags, StrVariableCommand, &Data, Desc " (default: " #Def ", max length: " #Len ")"); \ + static char s_aHelp[256]; \ + str_format(s_aHelp, sizeof(s_aHelp), "%s (default: \"%s\", max length: %d)", Desc, Def, Len - 1); \ + Register(#ScriptName, "?r", Flags, StrVariableCommand, &Data, s_aHelp); \ } #include "config_variables.h"