From 857f16b0367c2dcc3435cc48c1117bd2a27462c5 Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Sun, 4 Apr 2010 14:32:16 +0000 Subject: * (bug 3960) Don't exec team configs when restarting cgame (e.g. vid_restart) * Allow team configs to contain spaces --- src/cgame/cg_players.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/cgame/cg_players.c') diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index f3553035..c23d5697 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -762,19 +762,24 @@ void CG_NewClientInfo( int clientNum ) newInfo.team = atoi( v ); // if this is us, execute team-specific config files - // unfortunately, these get re-executed after a vid_restart, because the - // cgame can't tell the difference between that and joining a new server - if( clientNum == cg.clientNum && - ( !ci->infoValid || ci->team != newInfo.team ) ) - { - char config[ MAX_STRING_CHARS ]; + // the spectator config is a little unreliable because it's easy to get on + // to the spectator team without joining it - e.g. when a new game starts. + // It's not a big deal because the spec config is the least important + // slash used anyway. + // I guess it's possible for someone to change teams during a restart and + // for that to then be missed here. But that's rare enough that people can + // just exec the configs manually, I think. + if( clientNum == cg.clientNum && ci->infoValid && + ci->team != newInfo.team ) + { + char config[ MAX_CVAR_VALUE_STRING ]; trap_Cvar_VariableStringBuffer( va( "cg_%sConfig", BG_TeamName( newInfo.team ) ), config, sizeof( config ) ); if( config[ 0 ] ) - trap_SendConsoleCommand( va( "exec %s\n", config ) ); + trap_SendConsoleCommand( va( "exec \"%s\"\n", config ) ); } // model -- cgit