diff --git a/source/Makefile b/source/Makefile index 0e7cd85..9a4d2f1 100644 --- a/source/Makefile +++ b/source/Makefile @@ -43,6 +43,7 @@ EXE_sources=\ common.c \ crc.c \ cvar.c \ + sv_cvar.c \ mathlib.c \ math.S \ mdfour.c \ diff --git a/source/cl_cvar.c b/source/cl_cvar.c new file mode 100644 index 0000000..3d26acf --- /dev/null +++ b/source/cl_cvar.c @@ -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)); + } + } +} diff --git a/source/cvar.c b/source/cvar.c index 99a9821..db92e1d 100644 --- a/source/cvar.c +++ b/source/cvar.c @@ -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); } /* diff --git a/source/sv_cvar.c b/source/sv_cvar.c new file mode 100644 index 0000000..25967b7 --- /dev/null +++ b/source/sv_cvar.c @@ -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); + } +}