Changed Cvar_Set(char *, char*) to Cvar_Set(cvar_t *, char *). You can kill me now =]

This commit is contained in:
Anton E. Gavrilov 2000-04-03 14:30:02 +00:00
parent 81dd3e4912
commit f5620c9f5b
28 changed files with 99 additions and 99 deletions

View file

@ -355,9 +355,9 @@ void CL_Color_f (void)
bottom = 13;
snprintf(num, sizeof(num), "%i", top);
Cvar_Set ("topcolor", num);
Cvar_Set (topcolor, num);
snprintf(num, sizeof(num), "%i", bottom);
Cvar_Set ("bottomcolor", num);
Cvar_Set (bottomcolor, num);
}
/*
@ -463,7 +463,7 @@ void CL_ConnectionlessPacket (void)
"You may need to reload your server browser and QuakeForge.\n",
s, localid->string);
Con_Printf("===========================\n");
Cvar_Set("localid", "");
Cvar_Set(localid, "");
return;
}

View file

@ -803,7 +803,7 @@ void Cmd_CmdList_f (void)
Con_Printf("%s\n", cmd->name);
}
Con_Printf ("%d commands\n", i);
Con_Printf ("------------\n%d commands\n", i);
}
/*

View file

@ -136,32 +136,27 @@ Cvar_Set
============
*/
#if defined(QUAKEWORLD)
void Cvar_Set (char *var_name, char *value)
void Cvar_Set (cvar_t *var, char *value)
{
cvar_t *var;
var = Cvar_FindVar (var_name);
if (!var)
{ // there is an error in C code if this happens
Con_Printf ("Cvar_Set: variable %s not found\n", var_name);
return;
}
if(var->flags&CVAR_ROM) return;
#ifdef SERVERONLY
if (var->flags&CVAR_SERVERINFO)
{
Info_SetValueForKey (svs.info, var_name, value, MAX_SERVERINFO_STRING);
SV_SendServerInfoChange(var_name, value);
Info_SetValueForKey (svs.info, var->name, value, MAX_SERVERINFO_STRING);
SV_SendServerInfoChange(var->name, value);
// SV_BroadcastCommand ("fullserverinfo \"%s\"\n", svs.info);
}
#else
if (var->flags&CVAR_USERINFO)
{
Info_SetValueForKey (cls.userinfo, var_name, value, MAX_INFO_STRING);
Info_SetValueForKey (cls.userinfo, var->name, value, MAX_INFO_STRING);
if (cls.state >= ca_connected)
{
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, va("setinfo \"%s\" \"%s\"\n", var_name, value));
SZ_Print (&cls.netchan.message, va("setinfo \"%s\" \"%s\"\n", var->name, value));
}
}
#endif
@ -173,17 +168,12 @@ void Cvar_Set (char *var_name, char *value)
var->value = Q_atof (var->string);
}
#elif defined(UQUAKE)
void Cvar_Set (char *var_name, char *value)
void Cvar_Set (cvar_t *var, char *value)
{
cvar_t *var;
qboolean changed;
var = Cvar_FindVar (var_name);
if (!var)
{ // there is an error in C code if this happens
Con_Printf ("Cvar_Set: variable %s not found\n", var_name);
return;
}
// Don't change if this is a CVAR_ROM
if(var->flags&CVAR_ROM) return;
@ -227,7 +217,7 @@ qboolean Cvar_Command (void)
return true;
}
Cvar_Set (v->name, Cmd_Argv(1));
Cvar_Set (v, Cmd_Argv(1));
return true;
}
@ -265,7 +255,7 @@ void Cvar_Set_f(void)
var = Cvar_FindVar (var_name);
if (var)
{
Cvar_Set (var->name, value);
Cvar_Set (var, value);
}
else
{
@ -291,7 +281,7 @@ void Cvar_Toggle_f (void)
return;
}
Cvar_Set (var->name, var->value ? "0" : "1");
Cvar_Set (var, var->value ? "0" : "1");
}
void Cvar_Help_f (void)
@ -318,11 +308,13 @@ void Cvar_Help_f (void)
void Cvar_CvarList_f (void)
{
cvar_t *var;
int i;
for (var = cvar_vars; var ; var = var->next)
for (var=cvar_vars, i=0 ; var ; var=var->next, i++)
{
Con_Printf("%s\n",var->name);
}
Con_Printf ("------------\n%d variables\n", i);
}
void Cvar_Init()

View file

@ -78,7 +78,7 @@ typedef struct cvar_s
cvar_t *Cvar_Get (char *name, char *value, int cvarflags, char *description);
void Cvar_Set (char *var_name, char *value);
void Cvar_Set (cvar_t *var, char *value);
// equivelant to "<name> <variable>" typed at the console
float Cvar_VariableValue (char *var_name);

View file

@ -409,7 +409,7 @@ void Draw_Init (void)
// 3dfx can only handle 256 wide textures
if (!Q_strncasecmp ((char *)gl_renderer, "3dfx",4) ||
!Q_strncasecmp ((char *)gl_renderer, "Mesa",4))
Cvar_Set ("gl_max_size", "256");
Cvar_Set (gl_max_size, "256");
Cmd_AddCommand ("gl_texturemode", &Draw_TextureMode_f);

View file

@ -840,7 +840,7 @@ R_SetupFrame ( void ) {
r_wateralpha->value = 1;
#else
if (cl.maxclients > 1)
Cvar_Set ("r_fullbright", "0");
Cvar_Set (r_fullbright, "0");
#endif
R_AnimateLight ();

View file

@ -297,15 +297,15 @@ static void SCR_CalcRefdef (void)
// bound viewsize
if (scr_viewsize->value < 30)
Cvar_Set ("viewsize","30");
Cvar_Set (scr_viewsize,"30");
if (scr_viewsize->value > 120)
Cvar_Set ("viewsize","120");
Cvar_Set (scr_viewsize,"120");
// bound field of view
if (scr_fov->value < 10)
Cvar_Set ("fov","10");
Cvar_Set (scr_fov,"10");
if (scr_fov->value > 170)
Cvar_Set ("fov","170");
Cvar_Set (scr_fov,"170");
size = scr_viewsize->value;

View file

@ -122,9 +122,9 @@ qboolean IN_ReadJoystick (void);
void Toggle_AuxLook_f (void)
{
if (aux_look->value)
Cvar_Set ("auxlook","0");
Cvar_Set (aux_look,"0");
else
Cvar_Set ("auxlook","1");
Cvar_Set (aux_look,"1");
}

View file

@ -120,7 +120,7 @@ void Netchan_Init (void)
showpackets = Cvar_Get ("showpackets","0",0,"None");
showdrop = Cvar_Get ("showdrop","0",0,"None");
qport = Cvar_Get ("qport","0",0,"None");
Cvar_Set ("qport", va("%i", port));
Cvar_Set (qport, va("%i", port));
}
/*

View file

@ -956,11 +956,19 @@ float cvar (string)
*/
void PF_cvar_set (void)
{
char *var, *val;
char *var_name, *val;
cvar_t *var;
var = G_STRING(OFS_PARM0);
var_name = G_STRING(OFS_PARM0);
val = G_STRING(OFS_PARM1);
var = Cvar_FindVar(var_name);
if (!var)
{
Con_Printf ("PF_cvar_set: variable %s not found\n", var_name);
return;
}
Cvar_Set (var, val);
}

View file

@ -52,7 +52,7 @@ register_check ( void )
COM_FOpenFile("gfx/pop.lmp", &h);
if (h) {
Cvar_Set ("registered", "1");
Cvar_Set (registered, "1");
Qclose (h);
}
}

View file

@ -318,15 +318,15 @@ static void SCR_CalcRefdef (void)
// bound viewsize
if (scr_viewsize->value < 30)
Cvar_Set ("viewsize","30");
Cvar_Set (scr_viewsize,"30");
if (scr_viewsize->value > 120)
Cvar_Set ("viewsize","120");
Cvar_Set (scr_viewsize,"120");
// bound field of view
if (scr_fov->value < 10)
Cvar_Set ("fov","10");
Cvar_Set (scr_fov,"10");
if (scr_fov->value > 170)
Cvar_Set ("fov","170");
Cvar_Set (scr_fov,"170");
r_refdef.fov_x = scr_fov->value;
r_refdef.fov_y = CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);

View file

@ -217,7 +217,7 @@ void S_Init (void)
if (host_parms.memsize < 0x800000)
{
Cvar_Set ("loadas8bit", "1");
Cvar_Set (loadas8bit, "1");
Con_Printf ("loading all sounds as 8bit\n");
}

View file

@ -2135,7 +2135,7 @@ void VID_Gamma_f (void)
return;
}
Cvar_Set ("v_gamma", Cmd_Argv(1));
Cvar_Set (v_gamma, Cmd_Argv(1));
}

View file

@ -980,9 +980,9 @@ cl.simangles[ROLL] = 0; // FIXME
#else
// don't allow cheats in multiplayer
if (cl.maxclients > 1) {
Cvar_Set ("scr_ofsx", "0");
Cvar_Set ("scr_ofsy", "0");
Cvar_Set ("scr_ofsz", "0");
Cvar_Set (scr_ofsx, "0");
Cvar_Set (scr_ofsy, "0");
Cvar_Set (scr_ofsz, "0");
}
#endif

View file

@ -127,7 +127,7 @@ CL_PredictMove (void)
int oldphysent;
if (cl_pushlatency->value > 0)
Cvar_Set ("pushlatency", "0");
Cvar_Set (cl_pushlatency, "0");
if (cl.paused)
return;

View file

@ -408,19 +408,19 @@ M_AdjustSliders ( int dir )
switch (options_cursor) {
case 3: // screen size
Cvar_Set("scr_viewsize", va("%d",
bound(30, scr_viewsize->value + (dir * 10), 120)));
Cvar_Set(scr_viewsize, va("%d",
bound(30, (int)scr_viewsize->value + (dir * 10), 120)));
break;
case 4: // gamma
Cvar_Set("v_gamma", va("%f",
Cvar_Set(v_gamma, va("%f",
bound(0.5, v_gamma->value - (dir * 0.05), 1)));
break;
case 5: // mouse speed
Cvar_Set("sensitivity", va("%f",
Cvar_Set(sensitivity, va("%f",
bound(1, sensitivity->value + (dir * 0.05), 11)));
break;
case 6: // music volume
Cvar_Set("bgmvolume", va("%f",
Cvar_Set(bgmvolume, va("%f",
#ifdef _WIN32
bound(0, bgmvolume->value + dir, 1)));
#else
@ -428,37 +428,37 @@ M_AdjustSliders ( int dir )
#endif
break;
case 7: // sfx volume
Cvar_Set("volume", va("%f", bound(0, volume->value + (dir * 0.1), 1)));
Cvar_Set(volume, va("%f", bound(0, volume->value + (dir * 0.1), 1)));
break;
case 8: // allways run
if (cl_forwardspeed->value > 200) {
Cvar_Set("cl_forwardspeed", va("%d", 200));
Cvar_Set("cl_backspeed", va("%d", 200));
Cvar_Set(cl_forwardspeed, va("%d", 200));
Cvar_Set(cl_backspeed, va("%d", 200));
} else {
Cvar_Set("cl_forwardspeed", va("%d", 400));
Cvar_Set("cl_backspeed", va("%d", 400));
Cvar_Set(cl_forwardspeed, va("%d", 400));
Cvar_Set(cl_backspeed, va("%d", 400));
}
break;
case 9: // invert mouse
Cvar_Set("m_pitch", va("%f", -m_pitch->value));
Cvar_Set(m_pitch, va("%f", -m_pitch->value));
break;
case 10: // lookspring
Cvar_Set("lookspring", va("%d", !lookspring->value));
Cvar_Set(lookspring, va("%d", !lookspring->value));
break;
case 11: // lookstrafe
Cvar_Set("lookstrafe", va("%d", !lookstrafe->value));
Cvar_Set(lookstrafe, va("%d", !lookstrafe->value));
break;
case 12: // Use old-style sbar
Cvar_Set("cl_sbar", va("%d", !cl_sbar->value));
Cvar_Set(cl_sbar, va("%d", !cl_sbar->value));
break;
case 13: // HUD on left side
Cvar_Set("cl_hudswap", va("%d", !cl_hudswap->value));
Cvar_Set(cl_hudswap, va("%d", !cl_hudswap->value));
break;
default:

View file

@ -316,13 +316,13 @@ void SV_SpawnServer (char *server)
// make cvars consistant
//
if (coop->value)
Cvar_Set ("deathmatch", "0");
Cvar_Set (deathmatch, "0");
current_skill = (int)(skill->value + 0.5);
if (current_skill < 0)
current_skill = 0;
if (current_skill > 3)
current_skill = 3;
Cvar_Set ("skill", va("%d", (int)current_skill));
Cvar_Set (skill, va("%d", (int)current_skill));
// wipe the entire per-level structure
memset (&sv, 0, sizeof(sv));

View file

@ -196,7 +196,7 @@ int main (int argc, char **argv)
if (COM_CheckParm ("-nopriority"))
{
Cvar_Set ("sys_sleep", "0");
Cvar_Set (sys_sleep, "0");
}
else
{
@ -208,7 +208,7 @@ int main (int argc, char **argv)
// Tonik: sys_sleep > 0 causes packet loss on WinNT (why?)
if (WinNT)
Cvar_Set ("sys_sleep", "0");
Cvar_Set (sys_sleep, "0");
// run one frame immediately for first heartbeat
SV_Frame (0.1);

View file

@ -1001,7 +1001,7 @@ void Host_Name_f (void)
{
if (Q_strcmp(cl_name->string, newName) == 0)
return;
Cvar_Set ("_cl_name", newName);
Cvar_Set (cl_name, newName);
if (cls.state >= ca_connected)
Cmd_ForwardToServer ();
return;

View file

@ -844,7 +844,7 @@ forward:
if (Q_strcmp(cl_name->string, setup_myname) != 0)
Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
if (Q_strcmp(hostname->string, setup_hostname) != 0)
Cvar_Set("hostname", setup_hostname);
Cvar_Set(hostname, setup_hostname);
if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
m_entersound = true;
@ -1118,19 +1118,19 @@ M_AdjustSliders ( int dir )
switch (options_cursor) {
case 3: // screen size
Cvar_Set("scr_viewsize", va("%d",
bound(30, scr_viewsize->value + (dir * 10), 120)));
Cvar_Set(scr_viewsize, va("%d",
bound(30, (int)scr_viewsize->value + (dir * 10), 120)));
break;
case 4: // gamma
Cvar_Set("v_gamma", va("%f",
Cvar_Set(v_gamma, va("%f",
bound(0.5, v_gamma->value - (dir * 0.05), 1)));
break;
case 5: // mouse speed
Cvar_Set("sensitivity", va("%f",
Cvar_Set(sensitivity, va("%f",
bound(1, sensitivity->value + (dir * 0.05), 11)));
break;
case 6: // music volume
Cvar_Set("bgmvolume", va("%f",
Cvar_Set(bgmvolume, va("%f",
#ifdef _WIN32
bound(0, bgmvolume->value + dir, 1)));
#else
@ -1138,37 +1138,37 @@ M_AdjustSliders ( int dir )
#endif
break;
case 7: // sfx volume
Cvar_Set("volume", va("%f", bound(0, volume->value + (dir * 0.1), 1)));
Cvar_Set(volume, va("%f", bound(0, volume->value + (dir * 0.1), 1)));
break;
case 8: // allways run
if (cl_forwardspeed->value > 200) {
Cvar_Set("cl_forwardspeed", va("%d", 200));
Cvar_Set("cl_backspeed", va("%d", 200));
Cvar_Set(cl_forwardspeed, va("%d", 200));
Cvar_Set(cl_backspeed, va("%d", 200));
} else {
Cvar_Set("cl_forwardspeed", va("%d", 400));
Cvar_Set("cl_backspeed", va("%d", 400));
Cvar_Set(cl_forwardspeed, va("%d", 400));
Cvar_Set(cl_backspeed, va("%d", 400));
}
break;
case 9: // invert mouse
Cvar_Set("m_pitch", va("%f", -m_pitch->value));
Cvar_Set(m_pitch, va("%f", -m_pitch->value));
break;
case 10: // lookspring
Cvar_Set("lookspring", va("%d", !lookspring->value));
Cvar_Set(lookspring, va("%d", !lookspring->value));
break;
case 11: // lookstrafe
Cvar_Set("lookstrafe", va("%d", !lookstrafe->value));
Cvar_Set(lookstrafe, va("%d", !lookstrafe->value));
break;
case 12: // Use old-style sbar
Cvar_Set("cl_sbar", va("%d", !cl_sbar->value));
Cvar_Set(cl_sbar, va("%d", !cl_sbar->value));
break;
case 13: // HUD on left side
Cvar_Set("cl_hudswap", va("%d", !cl_hudswap->value));
Cvar_Set(cl_hudswap, va("%d", !cl_hudswap->value));
break;
default:

View file

@ -353,10 +353,10 @@ void TTY_SetComPortConfig (int portNumber, int port, int irq, int baud, qboolean
else
temp = 0.0;
Cvar_SetValue ("_config_com_port", (float)port);
Cvar_SetValue ("_config_com_irq", (float)irq);
Cvar_SetValue ("_config_com_baud", (float)baud);
Cvar_SetValue ("_config_com_modem", temp);
Cvar_SetValue (config_com_port, (float)port);
Cvar_SetValue (config_com_irq, (float)irq);
Cvar_SetValue (config_com_baud, (float)baud);
Cvar_SetValue (config_com_modem, temp);
}
void TTY_GetModemConfig (int portNumber, char *dialType, char *clear, char *init, char *hangup)
@ -382,10 +382,10 @@ void TTY_SetModemConfig (int portNumber, char *dialType, char *clear, char *init
p->modemInitialized = false;
Cvar_Set ("_config_modem_dialtype", dialType);
Cvar_Set ("_config_modem_clear", clear);
Cvar_Set ("_config_modem_init", init);
Cvar_Set ("_config_modem_hangup", hangup);
Cvar_Set (config_modem_dialtype, dialType);
Cvar_Set (config_modem_clear, clear);
Cvar_Set (config_modem_init, init);
Cvar_Set (config_modem_hangup, hangup);
}

View file

@ -239,9 +239,9 @@ static void MaxPlayers_f (void)
svs.maxclients = n;
if (n == 1)
Cvar_Set ("deathmatch", "0");
Cvar_Set (deathmatch, "0");
else
Cvar_Set ("deathmatch", "1");
Cvar_Set (deathmatch, "1");
}

View file

@ -93,7 +93,7 @@ int MPATH_Init (void)
break;
buff[i] = 0;
}
Cvar_Set ("hostname", buff);
Cvar_Set (hostname, buff);
}
}

View file

@ -108,7 +108,7 @@ int UDP_Init (void)
if (Q_strcmp(hostname->string, "UNNAMED") == 0)
{
buff[15] = 0;
Cvar_Set ("hostname", buff);
Cvar_Set (hostname, buff);
}
if ((net_controlsocket = UDP_OpenSocket (0)) == -1)

View file

@ -210,7 +210,7 @@ int WINS_Init (void)
break;
buff[i] = 0;
}
Cvar_Set ("hostname", buff);
Cvar_Set (hostname, buff);
}
i = COM_CheckParm ("-ip");

View file

@ -98,7 +98,7 @@ int WIPX_Init (void)
break;
buff[i] = 0;
}
Cvar_Set ("hostname", buff);
Cvar_Set (hostname, buff);
}
}

View file

@ -1178,7 +1178,7 @@ void SV_SpawnServer (char *server)
// let's not have any servers with no name
if (hostname->string[0] == 0)
Cvar_Set ("hostname", "UNNAMED");
Cvar_Set (hostname, "UNNAMED");
scr_centertime_off = 0;
Con_DPrintf ("SpawnServer: %s\n",server);