mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-01 20:30:57 +00:00
split out the server and client specific stuff from cvar.c into sv_cvar.c and cl_cvar.c respectively
This commit is contained in:
parent
0468f2804e
commit
a236fa53e6
4 changed files with 75 additions and 28 deletions
|
@ -43,6 +43,7 @@ EXE_sources=\
|
|||
common.c \
|
||||
crc.c \
|
||||
cvar.c \
|
||||
sv_cvar.c \
|
||||
mathlib.c \
|
||||
math.S \
|
||||
mdfour.c \
|
||||
|
|
35
source/cl_cvar.c
Normal file
35
source/cl_cvar.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "quakedef.h"
|
||||
|
||||
void
|
||||
Cvar_Info(cvar_t *var)
|
||||
{
|
||||
if (var->info)
|
||||
{
|
||||
Info_SetValueForKey (cls.userinfo, var->name, var->string, 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, string));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,11 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
// cvar.c -- dynamic variable tracking
|
||||
|
||||
#ifdef SERVERONLY
|
||||
#include "qwsvdef.h"
|
||||
#else
|
||||
#include "quakedef.h"
|
||||
#endif
|
||||
|
||||
cvar_t *cvar_vars;
|
||||
char *cvar_null_string = "";
|
||||
|
@ -104,16 +100,14 @@ char *Cvar_CompleteVariable (char *partial)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SERVERONLY
|
||||
void SV_SendServerInfoChange(char *key, char *value);
|
||||
#endif
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Set
|
||||
============
|
||||
*/
|
||||
|
||||
void Cvar_Info (cvar_t *var);
|
||||
|
||||
void Cvar_Set (char *var_name, char *value)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
@ -124,31 +118,14 @@ void Cvar_Set (char *var_name, char *value)
|
|||
Con_Printf ("Cvar_Set: variable %s not found\n", var_name);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SERVERONLY
|
||||
if (var->info)
|
||||
{
|
||||
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->info)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Z_Free (var->string); // free the old value string
|
||||
|
||||
var->string = Z_Malloc (Q_strlen(value)+1);
|
||||
Q_strcpy (var->string, value);
|
||||
var->value = Q_atof (var->string);
|
||||
|
||||
Cvar_Info(var);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
34
source/sv_cvar.c
Normal file
34
source/sv_cvar.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "qwsvdef.h"
|
||||
|
||||
void SV_SendServerInfoChange(char *key, char *value);
|
||||
|
||||
void
|
||||
Cvar_Info(cvar_t *var)
|
||||
{
|
||||
if (var->info)
|
||||
{
|
||||
Info_SetValueForKey (svs.info, var->name, var->string, MAX_SERVERINFO_STRING);
|
||||
SV_SendServerInfoChange(var->name, var->string);
|
||||
// SV_BroadcastCommand ("fullserverinfo \"%s\"\n", svs.info);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue