]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix changing of player name during a game
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 9 Feb 2024 08:12:34 +0000 (18:12 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 9 Feb 2024 10:17:54 +0000 (20:17 +1000)
Name changes applied when connecting or when the map changed, but not
during the game.
I broke it in 74b49d6e5412af206448119963e0a4b3617e8ca4 by not
noticing the user-visible name of the cvar is used to determine which
command (if any) is sent.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
cl_cmd.c
cl_main.c

index 681b83c1642340be0b5d1b965dd177f354b855c8..4556d2cf7ec8292c6b8bd0395945c69c8e102850 100644 (file)
--- a/cl_cmd.c
+++ b/cl_cmd.c
@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "cl_collision.h"
 
+/// User-visible names of these CF_USERINFO cvars must be matched in CL_SetInfo()!
 cvar_t cl_name = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "_cl_name", "player", "player name"};
 cvar_t cl_rate = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "rate", "20000", "connection speed"};
 cvar_t cl_rate_burstsize = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "rate_burstsize", "1024", "rate control burst size"};
@@ -37,6 +38,7 @@ cvar_t cl_team = {CF_CLIENT | CF_USERINFO | CF_ARCHIVE, "team", "none", "QW team
 cvar_t cl_skin = {CF_CLIENT | CF_USERINFO | CF_ARCHIVE, "skin", "", "QW player skin name (example: base)"};
 cvar_t cl_noaim = {CF_CLIENT | CF_USERINFO | CF_ARCHIVE, "noaim", "1", "QW option to disable vertical autoaim"};
 cvar_t cl_pmodel = {CF_CLIENT | CF_USERINFO | CF_ARCHIVE, "pmodel", "0", "current player model number in nehahra"};
+
 cvar_t r_fixtrans_auto = {CF_CLIENT, "r_fixtrans_auto", "0", "automatically fixtrans textures (when set to 2, it also saves the fixed versions to a fixtrans directory)"};
 
 extern cvar_t rcon_secure;
index cba1b7560298eed2df02b2cdc9815b64dd3de0c8..efc6ba4da7fdea21fc9a8204263006d620f25883 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -257,7 +257,7 @@ void CL_SetInfo(const char *key, const char *value, qbool send, qbool allowstark
                        MSG_WriteByte(&cls.netcon->message, qw_clc_stringcmd);
                        MSG_WriteString(&cls.netcon->message, va(vabuf, sizeof(vabuf), "setinfo \"%s\" \"%s\"", key, value));
                }
-               else if (!strcasecmp(key, "name"))
+               else if (!strcasecmp(key, "_cl_name") || !strcasecmp(key, "name"))
                {
                        MSG_WriteByte(&cls.netcon->message, clc_stringcmd);
                        MSG_WriteString(&cls.netcon->message, va(vabuf, sizeof(vabuf), "name \"%s\"", value));