From bf3b7fc5b03298cee514ab7e190de5bef99f614f Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 1 Feb 2020 18:20:35 -0800 Subject: [PATCH] Clean player name before joining!!! --- src/d_clisrv.c | 6 ++++++ src/d_netcmd.c | 2 +- src/d_netcmd.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 704fc0901..bcae17aa3 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1275,8 +1275,14 @@ static boolean CL_SendJoin(void) netbuffer->u.clientcfg.localplayers = localplayers; netbuffer->u.clientcfg.version = VERSION; netbuffer->u.clientcfg.subversion = SUBVERSION; + + CleanupPlayerName(consoleplayer, cv_playername.zstring); + if (splitscreen) + CleanupPlayerName(1, cv_playername2.zstring);/* 1 is a HACK? oh no */ + strncpy(netbuffer->u.clientcfg.names[0], cv_playername.zstring, MAXPLAYERNAME); strncpy(netbuffer->u.clientcfg.names[1], cv_playername2.zstring, MAXPLAYERNAME); + return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak)); } diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b74a8a76d..cfd2162c5 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -982,7 +982,7 @@ boolean EnsurePlayerNameIsGood(char *name, INT32 playernum) * SetPlayerName * \author Graue */ -static void CleanupPlayerName(INT32 playernum, const char *newname) +void CleanupPlayerName(INT32 playernum, const char *newname) { char *buf; char *p; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 8f857c6db..f258cde62 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -194,6 +194,7 @@ typedef union { // add game commands, needs cleanup void D_RegisterServerCommands(void); void D_RegisterClientCommands(void); +void CleanupPlayerName(INT32 playernum, const char *newname); boolean EnsurePlayerNameIsGood(char *name, INT32 playernum); void D_SendPlayerConfig(void); void Command_ExitGame_f(void);