aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-10-19 16:52:16 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-10-19 16:52:16 +0000
commit7cf1bf5891f301205f5a2445faebd377a50d4645 (patch)
tree3feb26d5dece24579b10bfa98221fbe2f4467407 /code
parent344cd723cb23bf72ebe7cac4d68ee9bb441c410a (diff)
downloadioquake3-aero-7cf1bf5891f301205f5a2445faebd377a50d4645.tar.gz
ioquake3-aero-7cf1bf5891f301205f5a2445faebd377a50d4645.zip
- Applied patch from /dev/humancontroller to set cvar_modifiedFlags from Cvar_Set_f (#3636)
- Exchanged ugly code with Cmd_ArgsFrom() git-svn-id: svn://svn.icculus.org/quake3/trunk@1684 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r--code/qcommon/cvar.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/code/qcommon/cvar.c b/code/qcommon/cvar.c
index d4809ae..a37de12 100644
--- a/code/qcommon/cvar.c
+++ b/code/qcommon/cvar.c
@@ -739,12 +739,12 @@ weren't declared in C code.
============
*/
void Cvar_Set_f( void ) {
- int i, c, l, len;
- char cmd[5], combined[MAX_STRING_TOKENS];
- cvar_t *v;
+ int c;
+ char *cmd;
+ cvar_t *v;
c = Cmd_Argc();
- Q_strncpyz( cmd, Cmd_Argv(0), sizeof( cmd ) );
+ cmd = Cmd_Argv(0);
if ( c < 2 ) {
Com_Printf ("usage: %s <variable> <value>\n", cmd);
@@ -755,35 +755,28 @@ void Cvar_Set_f( void ) {
return;
}
- combined[0] = 0;
- l = 0;
- for ( i = 2 ; i < c ; i++ ) {
- len = strlen ( Cmd_Argv( i ) + 1 );
- if ( l + len >= MAX_STRING_TOKENS - 2 ) {
- break;
- }
- strcat( combined, Cmd_Argv( i ) );
- if ( i != c-1 ) {
- strcat( combined, " " );
- }
- l += len;
- }
- v = Cvar_Set2 (Cmd_Argv(1), combined, qfalse);
+ v = Cvar_Set2 (Cmd_Argv(1), Cmd_ArgsFrom(2), qfalse);
if( !v ) {
return;
}
switch( cmd[3] ) {
- default:
- case '\0':
+ case 'a':
+ if( !( v->flags & CVAR_ARCHIVE ) ) {
+ v->flags |= CVAR_ARCHIVE;
+ cvar_modifiedFlags |= CVAR_ARCHIVE;
+ }
break;
case 'u':
- v->flags |= CVAR_USERINFO;
+ if( !( v->flags & CVAR_USERINFO ) ) {
+ v->flags |= CVAR_USERINFO;
+ cvar_modifiedFlags |= CVAR_USERINFO;
+ }
break;
case 's':
- v->flags |= CVAR_SERVERINFO;
- break;
- case 'a':
- v->flags |= CVAR_ARCHIVE;
+ if( !( v->flags & CVAR_SERVERINFO ) ) {
+ v->flags |= CVAR_SERVERINFO;
+ cvar_modifiedFlags |= CVAR_SERVERINFO;
+ }
break;
}
}