From 6b72cddee4efc077bfe7ce185ada0e5c15332d4d Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Mon, 29 Jun 2020 03:21:06 +0000 Subject: [PATCH] Add -Wshadow cflag and eliminate its warnings, including with g++ git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12750 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_input.c | 2 +- cl_main.c | 12 ++++---- cl_parse.c | 24 +++++++-------- cl_screen.c | 2 +- client.h | 12 ++++---- host_cmd.c | 86 ++++++++++++++++++++++++++--------------------------- makefile | 2 +- mdfour.c | 12 ++++---- mdfour.h | 8 ++--- menu.c | 14 ++++----- netconn.c | 8 ++--- sv_ccmds.c | 2 +- sv_user.c | 16 +++++----- 13 files changed, 100 insertions(+), 100 deletions(-) diff --git a/cl_input.c b/cl_input.c index c940395a..8ccd3477 100644 --- a/cl_input.c +++ b/cl_input.c @@ -2114,7 +2114,7 @@ void CL_SendMove(void) // send the reliable message (forwarded commands) if there is one if (buf.cursize || cls.netcon->message.cursize) - NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, max(20*(buf.cursize+40), rate.integer), rate_burstsize.integer, false); + NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, max(20*(buf.cursize+40), cl_rate.integer), cl_rate_burstsize.integer, false); if (quemove) { diff --git a/cl_main.c b/cl_main.c index 4eae2894..3026f669 100644 --- a/cl_main.c +++ b/cl_main.c @@ -209,8 +209,8 @@ void CL_ClearState(void) CL_Screen_NewMap(); } -extern cvar_t topcolor; -extern cvar_t bottomcolor; +extern cvar_t cl_topcolor; +extern cvar_t cl_bottomcolor; void CL_SetInfo(const char *key, const char *value, qboolean send, qboolean allowstarkey, qboolean allowmodel, qboolean quiet) { @@ -259,12 +259,12 @@ void CL_SetInfo(const char *key, const char *value, qboolean send, qboolean allo else if (!strcasecmp(key, "topcolor")) { MSG_WriteByte(&cls.netcon->message, clc_stringcmd); - MSG_WriteString(&cls.netcon->message, va(vabuf, sizeof(vabuf), "color %i %i", atoi(value), bottomcolor.integer)); + MSG_WriteString(&cls.netcon->message, va(vabuf, sizeof(vabuf), "color %i %i", atoi(value), cl_bottomcolor.integer)); } else if (!strcasecmp(key, "bottomcolor")) { MSG_WriteByte(&cls.netcon->message, clc_stringcmd); - MSG_WriteString(&cls.netcon->message, va(vabuf, sizeof(vabuf), "color %i %i", topcolor.integer, atoi(value))); + MSG_WriteString(&cls.netcon->message, va(vabuf, sizeof(vabuf), "color %i %i", cl_topcolor.integer, atoi(value))); } else if (!strcasecmp(key, "rate")) { @@ -503,7 +503,7 @@ CL_EstablishConnection Host should be either "local" or a net address ===================== */ -void CL_EstablishConnection(const char *host, int firstarg) +void CL_EstablishConnection(const char *address, int firstarg) { if (cls.state == ca_dedicated) return; @@ -523,7 +523,7 @@ void CL_EstablishConnection(const char *host, int firstarg) // make sure the client ports are open before attempting to connect NetConn_UpdateSockets(); - if (LHNETADDRESS_FromString(&cls.connect_address, host, 26000) && (cls.connect_mysocket = NetConn_ChooseClientSocketForAddress(&cls.connect_address))) + if (LHNETADDRESS_FromString(&cls.connect_address, address, 26000) && (cls.connect_mysocket = NetConn_ChooseClientSocketForAddress(&cls.connect_address))) { cls.connect_trying = true; cls.connect_remainingtries = 3; diff --git a/cl_parse.c b/cl_parse.c index 2d8f04ab..aa7a311c 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1562,37 +1562,37 @@ static void CL_DownloadFinished_f(cmd_state_t *cmd) CL_BeginDownloads(false); } -extern cvar_t topcolor; -extern cvar_t bottomcolor; +extern cvar_t cl_topcolor; +extern cvar_t cl_bottomcolor; static void CL_SendPlayerInfo(void) { char vabuf[1024]; MSG_WriteByte (&cls.netcon->message, clc_stringcmd); - MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "name \"%s\"", name.string)); + MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "name \"%s\"", cl_name.string)); MSG_WriteByte (&cls.netcon->message, clc_stringcmd); - MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "color %i %i", topcolor.integer, bottomcolor.integer)); + MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "color %i %i", cl_topcolor.integer, cl_bottomcolor.integer)); MSG_WriteByte (&cls.netcon->message, clc_stringcmd); - MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "rate %i", rate.integer)); + MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "rate %i", cl_rate.integer)); MSG_WriteByte (&cls.netcon->message, clc_stringcmd); - MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "rate_burstsize %i", rate_burstsize.integer)); + MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "rate_burstsize %i", cl_rate_burstsize.integer)); - if (pmodel.integer) + if (cl_pmodel.integer) { MSG_WriteByte (&cls.netcon->message, clc_stringcmd); - MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "pmodel %i", pmodel.integer)); + MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "pmodel %i", cl_pmodel.integer)); } - if (*playermodel.string) + if (*cl_playermodel.string) { MSG_WriteByte (&cls.netcon->message, clc_stringcmd); - MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "playermodel %s", playermodel.string)); + MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "playermodel %s", cl_playermodel.string)); } - if (*playerskin.string) + if (*cl_playerskin.string) { MSG_WriteByte (&cls.netcon->message, clc_stringcmd); - MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "playerskin %s", playerskin.string)); + MSG_WriteString (&cls.netcon->message, va(vabuf, sizeof(vabuf), "playerskin %s", cl_playerskin.string)); } } diff --git a/cl_screen.c b/cl_screen.c index 01a6fbdd..7a8bf931 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -343,7 +343,7 @@ static void SCR_DrawNetGraph (void) graphwidth = 120; graphheight = 70; graphscale = 1.0f / 1500.0f; - graphlimit = rate.integer; + graphlimit = cl_rate.integer; netgraphsperrow = (vid_conwidth.integer + separator2) / (graphwidth * 2 + separator1 + separator2); netgraphsperrow = max(netgraphsperrow, 1); diff --git a/client.h b/client.h index 75af05c8..c154d991 100644 --- a/client.h +++ b/client.h @@ -1459,13 +1459,13 @@ client_state_t; // // cvars // -extern cvar_t name; +extern cvar_t cl_name; extern cvar_t cl_color; -extern cvar_t rate; -extern cvar_t rate_burstsize; -extern cvar_t pmodel; -extern cvar_t playermodel; -extern cvar_t playerskin; +extern cvar_t cl_rate; +extern cvar_t cl_rate_burstsize; +extern cvar_t cl_pmodel; +extern cvar_t cl_playermodel; +extern cvar_t cl_playerskin; extern cvar_t rcon_password; extern cvar_t rcon_address; diff --git a/host_cmd.c b/host_cmd.c index 24535a94..a7109dd4 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -38,15 +38,15 @@ cvar_t rcon_password = {CVAR_CLIENT | CVAR_SERVER | CVAR_PRIVATE, "rcon_password cvar_t rcon_secure = {CVAR_CLIENT | CVAR_SERVER, "rcon_secure", "0", "force secure rcon authentication (1 = time based, 2 = challenge based); NOTE: changing rcon_secure clears rcon_password, so set rcon_secure always before rcon_password"}; cvar_t rcon_secure_challengetimeout = {CVAR_CLIENT, "rcon_secure_challengetimeout", "5", "challenge-based secure rcon: time out requests if no challenge came within this time interval"}; cvar_t rcon_address = {CVAR_CLIENT, "rcon_address", "", "server address to send rcon commands to (when not connected to a server)"}; -cvar_t name = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "name", "player", "change your player name"}; -cvar_t topcolor = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "topcolor", "0", "change the color of your shirt"}; -cvar_t bottomcolor = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "bottomcolor", "0", "change the color of your pants"}; -cvar_t team = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "team", "none", "QW team (4 character limit, example: blue)"}; -cvar_t skin = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "skin", "", "QW player skin name (example: base)"}; -cvar_t playermodel = {CVAR_CLIENT | CVAR_SERVER | CVAR_USERINFO | CVAR_SAVE, "playermodel", "", "current player model in Nexuiz/Xonotic"}; -cvar_t playerskin = {CVAR_CLIENT | CVAR_SERVER | CVAR_USERINFO | CVAR_SAVE, "playerskin", "", "current player skin in Nexuiz/Xonotic"}; -cvar_t noaim = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "noaim", "1", "QW option to disable vertical autoaim"}; -cvar_t pmodel = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "pmodel", "0", "current player model number in nehahra"}; +cvar_t cl_name = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "name", "player", "change your player name"}; +cvar_t cl_topcolor = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "topcolor", "0", "change the color of your shirt"}; +cvar_t cl_bottomcolor = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "bottomcolor", "0", "change the color of your pants"}; +cvar_t cl_team = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "team", "none", "QW team (4 character limit, example: blue)"}; +cvar_t cl_skin = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "skin", "", "QW player skin name (example: base)"}; +cvar_t cl_playermodel = {CVAR_CLIENT | CVAR_SERVER | CVAR_USERINFO | CVAR_SAVE, "playermodel", "", "current player model in Nexuiz/Xonotic"}; +cvar_t cl_playerskin = {CVAR_CLIENT | CVAR_SERVER | CVAR_USERINFO | CVAR_SAVE, "playerskin", "", "current player skin in Nexuiz/Xonotic"}; +cvar_t cl_noaim = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "noaim", "1", "QW option to disable vertical autoaim"}; +cvar_t cl_pmodel = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "pmodel", "0", "current player model number in nehahra"}; cvar_t r_fixtrans_auto = {CVAR_CLIENT, "r_fixtrans_auto", "0", "automatically fixtrans textures (when set to 2, it also saves the fixed versions to a fixtrans directory)"}; //============================================================================ @@ -67,7 +67,7 @@ static void CL_Playermodel_f(cmd_state_t *cmd) { if (cmd->source == src_command) { - Con_Printf("\"playermodel\" is \"%s\"\n", playermodel.string); + Con_Printf("\"playermodel\" is \"%s\"\n", cl_playermodel.string); } return; } @@ -126,7 +126,7 @@ static void CL_Playerskin_f(cmd_state_t *cmd) { if (cmd->source == src_command) { - Con_Printf("\"playerskin\" is \"%s\"\n", playerskin.string); + Con_Printf("\"playerskin\" is \"%s\"\n", cl_playerskin.string); } return; } @@ -184,22 +184,22 @@ static void CL_Color_c(cvar_t *var) { char vabuf[1024]; - Cvar_Set_NoCallback(&topcolor, va(vabuf, sizeof(vabuf), "%i", ((var->integer >> 4) & 15))); - Cvar_Set_NoCallback(&bottomcolor, va(vabuf, sizeof(vabuf), "%i", (var->integer & 15))); + Cvar_Set_NoCallback(&cl_topcolor, va(vabuf, sizeof(vabuf), "%i", ((var->integer >> 4) & 15))); + Cvar_Set_NoCallback(&cl_bottomcolor, va(vabuf, sizeof(vabuf), "%i", (var->integer & 15))); } static void CL_Topcolor_c(cvar_t *var) { char vabuf[1024]; - Cvar_Set_NoCallback(&cl_color, va(vabuf, sizeof(vabuf), "%i", var->integer*16 + bottomcolor.integer)); + Cvar_Set_NoCallback(&cl_color, va(vabuf, sizeof(vabuf), "%i", var->integer*16 + cl_bottomcolor.integer)); } static void CL_Bottomcolor_c(cvar_t *var) { char vabuf[1024]; - Cvar_Set_NoCallback(&cl_color, va(vabuf, sizeof(vabuf), "%i", topcolor.integer*16 + var->integer)); + Cvar_Set_NoCallback(&cl_color, va(vabuf, sizeof(vabuf), "%i", cl_topcolor.integer*16 + var->integer)); } static void CL_Color_f(cmd_state_t *cmd) @@ -210,7 +210,7 @@ static void CL_Color_f(cmd_state_t *cmd) { if (cmd->source == src_command) { - Con_Printf("\"color\" is \"%i %i\"\n", topcolor.integer, bottomcolor.integer); + Con_Printf("\"color\" is \"%i %i\"\n", cl_topcolor.integer, cl_bottomcolor.integer); Con_Print("color <0-15> [0-15]\n"); } return; @@ -231,8 +231,8 @@ static void CL_Color_f(cmd_state_t *cmd) * happens twice here. Perhaps find a cleaner way? */ - top = top >= 0 ? top : topcolor.integer; - bottom = bottom >= 0 ? bottom : bottomcolor.integer; + top = top >= 0 ? top : cl_topcolor.integer; + bottom = bottom >= 0 ? bottom : cl_bottomcolor.integer; top &= 15; bottom &= 15; @@ -245,14 +245,14 @@ static void CL_Color_f(cmd_state_t *cmd) if (cmd->source == src_command) { - Cvar_SetValueQuick(&topcolor, top); - Cvar_SetValueQuick(&bottomcolor, bottom); + Cvar_SetValueQuick(&cl_topcolor, top); + Cvar_SetValueQuick(&cl_bottomcolor, bottom); return; } } -cvar_t rate = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "rate", "20000", "change your connection speed"}; -cvar_t rate_burstsize = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "rate_burstsize", "1024", "internal storage cvar for current rate control burst size (changed by rate_burstsize command)"}; +cvar_t cl_rate = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "rate", "20000", "change your connection speed"}; +cvar_t cl_rate_burstsize = {CVAR_CLIENT | CVAR_SAVE | CVAR_USERINFO, "rate_burstsize", "1024", "internal storage cvar for current rate control burst size (changed by rate_burstsize command)"}; /* ====================== @@ -270,7 +270,7 @@ static void CL_PModel_f(cmd_state_t *cmd) { if (cmd->source == src_command) { - Con_Printf("\"pmodel\" is \"%s\"\n", pmodel.string); + Con_Printf("\"pmodel\" is \"%s\"\n", cl_pmodel.string); } return; } @@ -278,7 +278,7 @@ static void CL_PModel_f(cmd_state_t *cmd) if (cmd->source == src_command) { - if (pmodel.integer == i) + if (cl_pmodel.integer == i) return; Cvar_SetValue (&cvars_all, "_cl_pmodel", i); if (cls.state == ca_connected) @@ -694,33 +694,33 @@ void Host_InitCommands (void) { dpsnprintf(cls.userinfo, sizeof(cls.userinfo), "\\name\\player\\team\\none\\topcolor\\0\\bottomcolor\\0\\rate\\10000\\msg\\1\\noaim\\1\\*ver\\dp"); - Cvar_RegisterVariable(&name); - Cvar_RegisterAlias(&name, "_cl_name"); + Cvar_RegisterVariable(&cl_name); + Cvar_RegisterAlias(&cl_name, "_cl_name"); Cvar_RegisterVariable(&cl_color); Cvar_RegisterCallback(&cl_color, CL_Color_c); - Cvar_RegisterVariable(&topcolor); - Cvar_RegisterCallback(&topcolor, CL_Topcolor_c); - Cvar_RegisterVariable(&bottomcolor); - Cvar_RegisterCallback(&bottomcolor, CL_Bottomcolor_c); - Cvar_RegisterVariable(&rate); - Cvar_RegisterAlias(&rate, "_cl_rate"); - Cvar_RegisterVariable(&rate_burstsize); - Cvar_RegisterAlias(&rate_burstsize, "_cl_rate_burstsize"); - Cvar_RegisterVariable(&pmodel); - Cvar_RegisterAlias(&pmodel, "_cl_pmodel"); - Cvar_RegisterVariable(&playermodel); - Cvar_RegisterAlias(&playermodel, "_cl_playermodel"); - Cvar_RegisterVariable(&playerskin); - Cvar_RegisterAlias(&playerskin, "_cl_playerskin"); + Cvar_RegisterVariable(&cl_topcolor); + Cvar_RegisterCallback(&cl_topcolor, CL_Topcolor_c); + Cvar_RegisterVariable(&cl_bottomcolor); + Cvar_RegisterCallback(&cl_bottomcolor, CL_Bottomcolor_c); + Cvar_RegisterVariable(&cl_rate); + Cvar_RegisterAlias(&cl_rate, "_cl_rate"); + Cvar_RegisterVariable(&cl_rate_burstsize); + Cvar_RegisterAlias(&cl_rate_burstsize, "_cl_rate_burstsize"); + Cvar_RegisterVariable(&cl_pmodel); + Cvar_RegisterAlias(&cl_pmodel, "_cl_pmodel"); + Cvar_RegisterVariable(&cl_playermodel); + Cvar_RegisterAlias(&cl_playermodel, "_cl_playermodel"); + Cvar_RegisterVariable(&cl_playerskin); + Cvar_RegisterAlias(&cl_playerskin, "_cl_playerskin"); Cvar_RegisterVariable(&rcon_password); Cvar_RegisterVariable(&rcon_address); Cvar_RegisterVariable(&rcon_secure); Cvar_RegisterCallback(&rcon_secure, CL_RCon_ClearPassword_c); Cvar_RegisterVariable(&rcon_secure_challengetimeout); Cvar_RegisterVariable(&r_fixtrans_auto); - Cvar_RegisterVariable(&team); - Cvar_RegisterVariable(&skin); - Cvar_RegisterVariable(&noaim); + Cvar_RegisterVariable(&cl_team); + Cvar_RegisterVariable(&cl_skin); + Cvar_RegisterVariable(&cl_noaim); Cmd_AddCommand(CMD_CLIENT, "color", CL_Color_f, "change your player shirt and pants colors"); Cmd_AddCommand(CMD_USERINFO, "pmodel", CL_PModel_f, "(Nehahra-only) change your player model choice"); diff --git a/makefile b/makefile index d3b6ce90..4fb547a0 100644 --- a/makefile +++ b/makefile @@ -217,7 +217,7 @@ ifeq ($(WIN64RELEASE), 1) # WINDRES=$(TARGET)-windres endif -CFLAGS_WARNINGS=-Wall -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement -Wmissing-prototypes +CFLAGS_WARNINGS=-Wall -Wshadow -Wold-style-definition -Wstrict-prototypes -Wsign-compare -Wdeclaration-after-statement -Wmissing-prototypes ifeq ($(DP_MAKE_TARGET), mingw) diff --git a/mdfour.c b/mdfour.c index f647df29..bfee0212 100644 --- a/mdfour.c +++ b/mdfour.c @@ -51,7 +51,7 @@ #define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + 0x6ED9EBA1,s) /* this applies md4 to 64 byte chunks */ -static void mdfour64(struct mdfour *md, uint32 *M) +static void mdfour64(struct mdfour_s *md, uint32 *M) { int j; uint32 AA, BB, CC, DD; @@ -121,7 +121,7 @@ static void copy4(unsigned char *out,uint32 x) out[3] = (x>>24)&0xFF; } -void mdfour_begin(struct mdfour *md) +void mdfour_begin(struct mdfour_s *md) { md->A = 0x67452301; md->B = 0xefcdab89; @@ -131,7 +131,7 @@ void mdfour_begin(struct mdfour *md) } -static void mdfour_tail(struct mdfour *md, const unsigned char *in, int n) +static void mdfour_tail(struct mdfour_s *md, const unsigned char *in, int n) { unsigned char buf[128]; uint32 M[16]; @@ -158,7 +158,7 @@ static void mdfour_tail(struct mdfour *md, const unsigned char *in, int n) } } -void mdfour_update(struct mdfour *md, const unsigned char *in, int n) +void mdfour_update(struct mdfour_s *md, const unsigned char *in, int n) { uint32 M[16]; @@ -179,7 +179,7 @@ void mdfour_update(struct mdfour *md, const unsigned char *in, int n) } -void mdfour_result(struct mdfour *md, unsigned char *out) +void mdfour_result(struct mdfour_s *md, unsigned char *out) { copy4(out, md->A); copy4(out+4, md->B); @@ -190,7 +190,7 @@ void mdfour_result(struct mdfour *md, unsigned char *out) void mdfour(unsigned char *out, const unsigned char *in, int n) { - struct mdfour md; + struct mdfour_s md; mdfour_begin(&md); mdfour_update(&md, in, n); mdfour_result(&md, out); diff --git a/mdfour.h b/mdfour.h index 3ef654c8..c6542a21 100644 --- a/mdfour.h +++ b/mdfour.h @@ -40,14 +40,14 @@ #define uint32 unsigned int32 #endif -struct mdfour { +struct mdfour_s { uint32 A, B, C, D; uint32 totalN; }; -void mdfour_begin(struct mdfour *md); // old: MD4Init -void mdfour_update(struct mdfour *md, const unsigned char *in, int n); //old: MD4Update -void mdfour_result(struct mdfour *md, unsigned char *out); // old: MD4Final +void mdfour_begin(struct mdfour_s *md); // old: MD4Init +void mdfour_update(struct mdfour_s *md, const unsigned char *in, int n); //old: MD4Update +void mdfour_result(struct mdfour_s *md, unsigned char *out); // old: MD4Final void mdfour(unsigned char *out, const unsigned char *in, int n); #endif // _MDFOUR_H diff --git a/menu.c b/menu.c index 5cad78b7..028ea6a2 100644 --- a/menu.c +++ b/menu.c @@ -1284,18 +1284,18 @@ static int setup_oldrate; #define NUM_SETUP_CMDS 5 -extern cvar_t topcolor; -extern cvar_t bottomcolor; +extern cvar_t cl_topcolor; +extern cvar_t cl_bottomcolor; void M_Menu_Setup_f(cmd_state_t *cmd) { key_dest = key_menu; m_state = m_setup; m_entersound = true; - strlcpy(setup_myname, name.string, sizeof(setup_myname)); - setup_top = setup_oldtop = topcolor.integer; - setup_bottom = setup_oldbottom = bottomcolor.integer; - setup_rate = rate.integer; + strlcpy(setup_myname, cl_name.string, sizeof(setup_myname)); + setup_top = setup_oldtop = cl_topcolor.integer; + setup_bottom = setup_oldbottom = cl_bottomcolor.integer; + setup_rate = cl_rate.integer; } static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load; @@ -1496,7 +1496,7 @@ forward: goto forward; // setup_cursor == 4 (Accept changes) - if (strcmp(name.string, setup_myname) != 0) + if (strcmp(cl_name.string, setup_myname) != 0) Cbuf_AddText(cmd, va(vabuf, sizeof(vabuf), "name \"%s\"\n", setup_myname) ); if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom) Cbuf_AddText(cmd, va(vabuf, sizeof(vabuf), "color %i %i\n", setup_top, setup_bottom) ); diff --git a/netconn.c b/netconn.c index 71c1a1e6..4731a0db 100755 --- a/netconn.c +++ b/netconn.c @@ -1265,7 +1265,7 @@ static int NetConn_ReceivedMessage(netconn_t *conn, const unsigned char *data, s conn->incoming_netgraph[conn->incoming_packetcounter].unreliablebytes = originallength + 28; conn->incoming_netgraph[conn->incoming_packetcounter].reliablebytes = NETGRAPH_NOPACKET; conn->incoming_netgraph[conn->incoming_packetcounter].ackbytes = NETGRAPH_NOPACKET; - NetConn_UpdateCleartime(&conn->incoming_cleartime, rate.integer, rate_burstsize.integer, originallength + 28); + NetConn_UpdateCleartime(&conn->incoming_cleartime, cl_rate.integer, cl_rate_burstsize.integer, originallength + 28); // limit bursts to one packet in size ("dialup mode" emulating old behaviour) if (net_test.integer) @@ -1361,7 +1361,7 @@ static int NetConn_ReceivedMessage(netconn_t *conn, const unsigned char *data, s conn->incoming_netgraph[conn->incoming_packetcounter].unreliablebytes = originallength + 28; conn->incoming_netgraph[conn->incoming_packetcounter].reliablebytes = NETGRAPH_NOPACKET; conn->incoming_netgraph[conn->incoming_packetcounter].ackbytes = NETGRAPH_NOPACKET; - NetConn_UpdateCleartime(&conn->incoming_cleartime, rate.integer, rate_burstsize.integer, originallength + 28); + NetConn_UpdateCleartime(&conn->incoming_cleartime, cl_rate.integer, cl_rate_burstsize.integer, originallength + 28); conn->nq.unreliableReceiveSequence = sequence + 1; conn->lastMessageTime = host.realtime; @@ -1391,7 +1391,7 @@ static int NetConn_ReceivedMessage(netconn_t *conn, const unsigned char *data, s else if (flags & NETFLAG_ACK) { conn->incoming_netgraph[conn->incoming_packetcounter].ackbytes += originallength + 28; - NetConn_UpdateCleartime(&conn->incoming_cleartime, rate.integer, rate_burstsize.integer, originallength + 28); + NetConn_UpdateCleartime(&conn->incoming_cleartime, cl_rate.integer, cl_rate_burstsize.integer, originallength + 28); if (sequence == (conn->nq.sendSequence - 1)) { @@ -1451,7 +1451,7 @@ static int NetConn_ReceivedMessage(netconn_t *conn, const unsigned char *data, s { unsigned char temppacket[8]; conn->incoming_netgraph[conn->incoming_packetcounter].reliablebytes += originallength + 28; - NetConn_UpdateCleartime(&conn->incoming_cleartime, rate.integer, rate_burstsize.integer, originallength + 28); + NetConn_UpdateCleartime(&conn->incoming_cleartime, cl_rate.integer, cl_rate_burstsize.integer, originallength + 28); conn->outgoing_netgraph[conn->outgoing_packetcounter].ackbytes += 8 + 28; diff --git a/sv_ccmds.c b/sv_ccmds.c index c2e3a667..d207a87a 100644 --- a/sv_ccmds.c +++ b/sv_ccmds.c @@ -1172,7 +1172,7 @@ static void SV_Kick_f(cmd_state_t *cmd) if (cls.state == ca_dedicated) who = "Console"; else - who = name.string; + who = cl_name.string; } else who = save->name; diff --git a/sv_user.c b/sv_user.c index 67dbdcc5..d6cd9aa0 100644 --- a/sv_user.c +++ b/sv_user.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "sv_demo.h" #define DEBUGMOVES 0 -static usercmd_t cmd; +static usercmd_t usercmd; extern cvar_t sv_autodemo_perclient; /* @@ -443,12 +443,12 @@ static void SV_WaterMove (void) AngleVectors(v_angle, forward, right, up); for (i=0 ; i<3 ; i++) - wishvel[i] = forward[i]*cmd.forwardmove + right[i]*cmd.sidemove; + wishvel[i] = forward[i]*usercmd.forwardmove + right[i]*usercmd.sidemove; - if (!cmd.forwardmove && !cmd.sidemove && !cmd.upmove) + if (!usercmd.forwardmove && !usercmd.sidemove && !usercmd.upmove) wishvel[2] -= 60; // drift towards bottom else - wishvel[2] += cmd.upmove; + wishvel[2] += usercmd.upmove; fwishspeed = VectorLength(wishvel); if (fwishspeed > sv_maxspeed.value) @@ -520,8 +520,8 @@ static void SV_AirMove (void) wishvel[1] = PRVM_serveredictvector(host_client->edict, angles)[1]; AngleVectors (wishvel, forward, right, up); - fmove = cmd.forwardmove; - smove = cmd.sidemove; + fmove = usercmd.forwardmove; + smove = usercmd.sidemove; // hack to not let you back into teleporter if (sv.time < PRVM_serveredictfloat(host_client->edict, teleport_time) && fmove < 0) @@ -531,7 +531,7 @@ static void SV_AirMove (void) wishvel[i] = forward[i]*fmove + right[i]*smove; if ((int)PRVM_serveredictfloat(host_client->edict, movetype) != MOVETYPE_WALK) - wishvel[2] += cmd.upmove; + wishvel[2] += usercmd.upmove; VectorCopy (wishvel, wishdir); wishspeed = VectorNormalizeLength(wishdir); @@ -599,7 +599,7 @@ void SV_ClientThink (void) if (PRVM_serveredictfloat(host_client->edict, health) <= 0) return; - cmd = host_client->cmd; + usercmd = host_client->cmd; // angles // show 1/3 the pitch angle and all the roll angle -- 2.39.2