From: Cloudwalk Date: Mon, 5 Jul 2021 17:22:36 +0000 (-0400) Subject: cvar: Rename Cvar_RegisterAlias to Cvar_RegisterVirtual X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c9c011dcf7b2ee062e9493139b89fff99f63ea25;p=xonotic%2Fdarkplaces.git cvar: Rename Cvar_RegisterAlias to Cvar_RegisterVirtual They're now called "virtual cvars" to avoid confusion with actual aliases. And it's just a better name for them. --- diff --git a/cl_cmd.c b/cl_cmd.c index 3687e247..9277ad50 100644 --- a/cl_cmd.c +++ b/cl_cmd.c @@ -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); diff --git a/cl_screen.c b/cl_screen.c index 75324c17..50a9df41 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -835,7 +835,7 @@ void CL_Screen_Init(void) Cvar_RegisterVariable(&scr_stipple); Cvar_RegisterVariable(&scr_refresh); Cvar_RegisterVariable(&net_graph); - Cvar_RegisterAlias(&net_graph, "shownetgraph"); + Cvar_RegisterVirtual(&net_graph, "shownetgraph"); Cvar_RegisterVariable(&cl_demo_mousegrab); Cvar_RegisterVariable(&timedemo_screenshotframelist); Cvar_RegisterVariable(&vid_touchscreen_outlinealpha); diff --git a/common.c b/common.c index 8cecd03d..35e96106 100644 --- a/common.c +++ b/common.c @@ -903,9 +903,9 @@ void COM_Init_Commands (void) Cvar_RegisterVariable (®istered); Cvar_RegisterVariable (&cmdline); Cvar_RegisterVariable(&cl_playermodel); - Cvar_RegisterAlias(&cl_playermodel, "_cl_playermodel"); + Cvar_RegisterVirtual(&cl_playermodel, "_cl_playermodel"); Cvar_RegisterVariable(&cl_playerskin); - Cvar_RegisterAlias(&cl_playerskin, "_cl_playerskin"); + Cvar_RegisterVirtual(&cl_playerskin, "_cl_playerskin"); // reconstitute the command line for the cmdline externally visible cvar n = 0; diff --git a/cvar.c b/cvar.c index 58562d6b..cbe8b0f6 100644 --- a/cvar.c +++ b/cvar.c @@ -492,28 +492,28 @@ void Cvar_RegisterCallback(cvar_t *variable, void (*callback)(cvar_t *)) variable->callback = callback; } -void Cvar_RegisterAlias(cvar_t *variable, const char *alias ) +void Cvar_RegisterVirtual(cvar_t *variable, const char *name ) { cvar_state_t *cvars = &cvars_all; cvar_hash_t *hash; int hashindex; - if(!*alias) + if(!*name) { - Con_Printf("Cvar_RegisterAlias: invalid alias name\n"); + Con_Printf("Cvar_RegisterVirtual: invalid virtual cvar name\n"); return; } // check for overlap with a command - if (Cmd_Exists(cmd_local, alias)) + if (Cmd_Exists(cmd_local, name)) { - Con_Printf("Cvar_RegisterAlias: %s is a command\n", alias); + Con_Printf("Cvar_RegisterVirtual: %s is a command\n", name); return; } - if(Cvar_FindVar(&cvars_all, alias, 0)) + if(Cvar_FindVar(&cvars_all, name, 0)) { - Con_Printf("Cvar_RegisterAlias: %s is a cvar\n", alias); + Con_Printf("Cvar_RegisterVirtual: %s is a cvar\n", name); return; } @@ -525,13 +525,13 @@ void Cvar_RegisterAlias(cvar_t *variable, const char *alias ) variable->aliases[variable->aliases_size + 1] = NULL; // Add to it - variable->aliases[variable->aliases_size] = (char *)Z_Malloc(strlen(alias) + 1); - memcpy(variable->aliases[variable->aliases_size], alias, strlen(alias) + 1); + variable->aliases[variable->aliases_size] = (char *)Z_Malloc(strlen(name) + 1); + memcpy(variable->aliases[variable->aliases_size], name, strlen(name) + 1); variable->aliases_size++; // link to head of list in this hash table index hash = (cvar_hash_t *)Z_Malloc(sizeof(cvar_hash_t)); - hashindex = CRC_Block((const unsigned char *)alias, strlen(alias)) % CVAR_HASHSIZE; + hashindex = CRC_Block((const unsigned char *)name, strlen(name)) % CVAR_HASHSIZE; hash->next = cvars->hashtable[hashindex]; cvars->hashtable[hashindex] = hash; hash->cvar = variable; diff --git a/cvar.h b/cvar.h index 66032039..92ea81cd 100644 --- a/cvar.h +++ b/cvar.h @@ -105,7 +105,7 @@ cvar_state_t; extern cvar_state_t cvars_all; extern cvar_state_t cvars_null; // used by cmd_serverfromclient which intentionally has no cvars available -void Cvar_RegisterAlias(cvar_t *variable, const char *alias ); +void Cvar_RegisterVirtual(cvar_t *variable, const char *name ); void Cvar_RegisterCallback(cvar_t *variable, void (*callback)(cvar_t *)); diff --git a/netconn.c b/netconn.c index af1aae28..1ec19fcd 100755 --- a/netconn.c +++ b/netconn.c @@ -3903,9 +3903,9 @@ void NetConn_Init(void) Cvar_RegisterVariable(&net_fakelag); Cvar_RegisterVariable(&net_fakeloss_send); Cvar_RegisterVariable(&net_fakeloss_receive); - Cvar_RegisterAlias(&net_fakelag, "cl_netlocalping"); - Cvar_RegisterAlias(&net_fakeloss_send, "cl_netpacketloss_send"); - Cvar_RegisterAlias(&net_fakeloss_receive, "cl_netpacketloss_receive"); + Cvar_RegisterVirtual(&net_fakelag, "cl_netlocalping"); + Cvar_RegisterVirtual(&net_fakeloss_send, "cl_netpacketloss_send"); + Cvar_RegisterVirtual(&net_fakeloss_receive, "cl_netpacketloss_receive"); Cvar_RegisterVariable(&hostname); Cvar_RegisterVariable(&developer_networking); Cvar_RegisterVariable(&cl_netport); diff --git a/sbar.c b/sbar.c index 6fc6c327..be139633 100644 --- a/sbar.c +++ b/sbar.c @@ -376,16 +376,16 @@ void Sbar_Init (void) Cvar_RegisterVariable(&cl_showdate_format); Cvar_RegisterVariable(&cl_showtex); - Cvar_RegisterAlias(&cl_showfps, "showfps"); - Cvar_RegisterAlias(&cl_showsound, "showsound"); - Cvar_RegisterAlias(&cl_showblur, "showblur"); - Cvar_RegisterAlias(&cl_showspeed, "showspeed"); - Cvar_RegisterAlias(&cl_showtopspeed, "showtopspeed"); - Cvar_RegisterAlias(&cl_showtime, "showtime"); - Cvar_RegisterAlias(&cl_showtime_format, "showtime_format"); - Cvar_RegisterAlias(&cl_showdate, "showdate"); - Cvar_RegisterAlias(&cl_showdate_format, "showdate_format"); - Cvar_RegisterAlias(&cl_showtex, "showtex"); + Cvar_RegisterVirtual(&cl_showfps, "showfps"); + Cvar_RegisterVirtual(&cl_showsound, "showsound"); + Cvar_RegisterVirtual(&cl_showblur, "showblur"); + Cvar_RegisterVirtual(&cl_showspeed, "showspeed"); + Cvar_RegisterVirtual(&cl_showtopspeed, "showtopspeed"); + Cvar_RegisterVirtual(&cl_showtime, "showtime"); + Cvar_RegisterVirtual(&cl_showtime_format, "showtime_format"); + Cvar_RegisterVirtual(&cl_showdate, "showdate"); + Cvar_RegisterVirtual(&cl_showdate_format, "showdate_format"); + Cvar_RegisterVirtual(&cl_showtex, "showtex"); Cvar_RegisterVariable(&sbar_alpha_bg); Cvar_RegisterVariable(&sbar_alpha_fg); diff --git a/sv_main.c b/sv_main.c index dcb91a7f..d1c9e71c 100644 --- a/sv_main.c +++ b/sv_main.c @@ -526,8 +526,8 @@ void SV_Init (void) Cvar_RegisterVariable (&skill); Cvar_RegisterVariable (&host_timescale); Cvar_RegisterCallback (&host_timescale, Host_Timescale_c); - Cvar_RegisterAlias (&host_timescale, "slowmo"); - Cvar_RegisterAlias (&host_timescale, "timescale"); + Cvar_RegisterVirtual (&host_timescale, "slowmo"); + Cvar_RegisterVirtual (&host_timescale, "timescale"); Cvar_RegisterVariable (&sv_accelerate); Cvar_RegisterVariable (&sv_aim); Cvar_RegisterVariable (&sv_airaccel_qw); @@ -618,7 +618,7 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_protocolname); Cvar_RegisterVariable (&sv_random_seed); Cvar_RegisterVariable (&host_limitlocal); - Cvar_RegisterAlias(&host_limitlocal, "sv_ratelimitlocalplayer"); + Cvar_RegisterVirtual(&host_limitlocal, "sv_ratelimitlocalplayer"); Cvar_RegisterVariable (&sv_sound_land); Cvar_RegisterVariable (&sv_sound_watersplash); Cvar_RegisterVariable (&sv_stepheight);