]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_cmd.c
Fix a bug in Cvar_RegisterVirtual which was corrupting memory when adding a second...
[xonotic/darkplaces.git] / cl_cmd.c
index 37ecbaa40d2c87f87461a84dbf745fe8af3b2af7..9277ad50964b77614057f9673895fd83a0cfd15b 100644 (file)
--- a/cl_cmd.c
+++ b/cl_cmd.c
@@ -28,11 +28,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "cl_collision.h"
 
-cvar_t cl_name = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "name", "player", "change your player name"};
-cvar_t cl_rate = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "rate", "20000", "change your connection speed"};
-cvar_t cl_rate_burstsize = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "rate_burstsize", "1024", "internal storage cvar for current rate control burst size (changed by rate_burstsize command)"};
-cvar_t cl_topcolor = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "topcolor", "0", "change the color of your shirt"};
-cvar_t cl_bottomcolor = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "bottomcolor", "0", "change the color of your pants"};
+cvar_t cl_name = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "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"};
+cvar_t cl_topcolor = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "topcolor", "0", "color of your shirt"};
+cvar_t cl_bottomcolor = {CF_CLIENT | CF_ARCHIVE | CF_USERINFO, "bottomcolor", "0", "color of your pants"};
 cvar_t cl_team = {CF_CLIENT | CF_USERINFO | CF_ARCHIVE, "team", "none", "QW team (4 character limit, example: blue)"};
 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"};
@@ -716,13 +716,13 @@ void CL_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(&cl_name);
-       Cvar_RegisterAlias(&cl_name, "_cl_name");
+       Cvar_RegisterVirtual(&cl_name, "_cl_name");
        Cvar_RegisterVariable(&cl_rate);
-       Cvar_RegisterAlias(&cl_rate, "_cl_rate");
+       Cvar_RegisterVirtual(&cl_rate, "_cl_rate");
        Cvar_RegisterVariable(&cl_rate_burstsize);
-       Cvar_RegisterAlias(&cl_rate_burstsize, "_cl_rate_burstsize");
+       Cvar_RegisterVirtual(&cl_rate_burstsize, "_cl_rate_burstsize");
        Cvar_RegisterVariable(&cl_pmodel);
-       Cvar_RegisterAlias(&cl_pmodel, "_cl_pmodel");
+       Cvar_RegisterVirtual(&cl_pmodel, "_cl_pmodel");
        Cvar_RegisterVariable(&cl_color);
        Cvar_RegisterCallback(&cl_color, CL_Color_c);
        Cvar_RegisterVariable(&cl_topcolor);
@@ -744,8 +744,8 @@ void CL_InitCommands(void)
        Cmd_AddCommand(CF_CLIENT, "packet", CL_Packet_f, "send a packet to the specified address:port containing a text string");
        Cmd_AddCommand(CF_CLIENT, "fullinfo", CL_FullInfo_f, "allows client to modify their userinfo");
        Cmd_AddCommand(CF_CLIENT, "setinfo", CL_SetInfo_f, "modifies your userinfo");
-       Cmd_AddCommand(CF_CLIENT, "sendcvar", CL_SendCvar_f, "sends the value of a cvar to the server as a sentcvar command, for use by QuakeC");
        Cmd_AddCommand(CF_CLIENT, "fixtrans", Image_FixTransparentPixels_f, "change alpha-zero pixels in an image file to sensible values, and write out a new TGA (warning: SLOW)");
+       host.hook.CL_SendCvar = CL_SendCvar_f;
 
        // commands that are only sent by server to client for execution
        Cmd_AddCommand(CF_CLIENT_FROM_SERVER, "pingplreport", CL_PingPLReport_f, "command sent by server containing client ping and packet loss values for scoreboard, triggered by pings command from client (not used by QW servers)");