diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2010-04-04 14:32:16 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:34 +0000 |
commit | 857f16b0367c2dcc3435cc48c1117bd2a27462c5 (patch) | |
tree | 247d07c12f78a36799cddc0443c8eb78b761bdc5 | |
parent | 5e8ec4fc1fc5f88d330269d86e367a56e00bdb0d (diff) |
* (bug 3960) Don't exec team configs when restarting cgame (e.g. vid_restart)
* Allow team configs to contain spaces
-rw-r--r-- | src/cgame/cg_players.c | 19 |
1 files changed, 12 insertions, 7 deletions
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 |