- limited length of server CVAR name to 63 characters

Due to limitation of network protocol server CVARs with longer names cannot propogate changes of their values properly

https://forum.zdoom.org/viewtopic.php?t=60729
This commit is contained in:
alexey.lysiuk 2018-05-31 10:29:58 +03:00
parent 0546c86716
commit bff2c8cf74

View file

@ -67,6 +67,19 @@ int cvar_defflags;
FBaseCVar::FBaseCVar (const char *var_name, uint32_t flags, void (*callback)(FBaseCVar &)) FBaseCVar::FBaseCVar (const char *var_name, uint32_t flags, void (*callback)(FBaseCVar &))
{ {
if (var_name != nullptr && (flags & CVAR_SERVERINFO))
{
// This limitation is imposed by network protocol which uses only 6 bits
// for name's length with terminating null character
static const size_t NAME_LENGHT_MAX = 63;
if (strlen(var_name) > NAME_LENGHT_MAX)
{
I_FatalError("Name of the server console variable \"%s\" is too long.\n"
"Its length should not exceed %zu characters.\n", var_name, NAME_LENGHT_MAX);
}
}
FBaseCVar *var; FBaseCVar *var;
var = FindCVar (var_name, NULL); var = FindCVar (var_name, NULL);