diff options
author | Tim Angus <tim@ngus.net> | 2009-10-09 22:24:05 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:45 +0000 |
commit | a1f3d889f1eca9b3a670363dd386480ec2b48a76 (patch) | |
tree | 80452d051386e4ca98efed6d2cd6f762416b46e7 /src/cgame | |
parent | d28ad7411a91881d168d45d0846adf80a579a02f (diff) |
* (bug #3836) Add [SV|trap]_SetConfigstringRestrictions which prevents some
clients receiving a config string
* Move BG_ClientList* to Com_ClientList*
* Split CS_STAGES into CS_ALIEN_STAGES and CS_HUMAN_STAGES
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_main.c | 10 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 65 |
3 files changed, 56 insertions, 21 deletions
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 01c24579..e0a9e83c 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -1430,9 +1430,9 @@ static qboolean CG_ClientIsReady( int clientNum ) { clientList_t ready; - BG_ClientListParse( &ready, CG_ConfigString( CS_CLIENTS_READY ) ); + Com_ClientListParse( &ready, CG_ConfigString( CS_CLIENTS_READY ) ); - return BG_ClientListTest( &ready, clientNum ); + return Com_ClientListContains( &ready, clientNum ); } static const char *CG_FeederItemText( float feederID, int index, int column, qhandle_t *handle ) @@ -1761,13 +1761,13 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) // get the gamestate from the client system trap_GetGameState( &cgs.gameState ); - // copy vote display strings so they don't show up blank if we see + // copy vote display strings so they don't show up blank if we see // the same one directly after connecting Q_strncpyz( cgs.voteString[ TEAM_NONE ], - CG_ConfigString( CS_VOTE_STRING + TEAM_NONE ), + CG_ConfigString( CS_VOTE_STRING + TEAM_NONE ), sizeof( cgs.voteString ) ); Q_strncpyz( cgs.voteString[ TEAM_ALIENS ], - CG_ConfigString( CS_VOTE_STRING + TEAM_ALIENS ), + CG_ConfigString( CS_VOTE_STRING + TEAM_ALIENS ), sizeof( cgs.voteString[ TEAM_ALIENS ] ) ); Q_strncpyz( cgs.voteString[ TEAM_HUMANS ], CG_ConfigString( CS_VOTE_STRING + TEAM_ALIENS ), diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 2cef1539..5e9d292c 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -796,7 +796,7 @@ void CG_NewClientInfo( int clientNum ) if( clientNum == cg.predictedPlayerState.clientNum ) { v = Info_ValueForKey( configstring, "ig" ); - BG_ClientListParse( &cgs.ignoreList, v ); + Com_ClientListParse( &cgs.ignoreList, v ); } // isolate the player's name diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 8e18fd9c..78769644 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -160,8 +160,25 @@ Called on load to set the initial values from configure strings */ void CG_SetConfigValues( void ) { - sscanf( CG_ConfigString( CS_STAGES ), "%d %d %d %d %d %d", &cgs.alienStage, &cgs.humanStage, - &cgs.alienCredits, &cgs.humanCredits, &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold ); + const char *alienStages = CG_ConfigString( CS_ALIEN_STAGES ); + const char *humanStages = CG_ConfigString( CS_HUMAN_STAGES ); + + if( alienStages[0] ) + { + sscanf( alienStages, "%d %d %d", &cgs.alienStage, &cgs.alienCredits, + &cgs.alienNextStageThreshold ); + } + else + cgs.alienStage = cgs.alienCredits = cgs.alienNextStageThreshold = 0; + + + if( humanStages[0] ) + { + sscanf( humanStages, "%d %d %d", &cgs.humanStage, &cgs.humanCredits, + &cgs.humanNextStageThreshold ); + } + else + cgs.humanStage = cgs.humanCredits = cgs.humanNextStageThreshold = 0; cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) ); cg.warmup = atoi( CG_ConfigString( CS_WARMUP ) ); @@ -273,21 +290,39 @@ static void CG_ConfigStringModified( void ) CG_ParseServerinfo( ); else if( num == CS_WARMUP ) CG_ParseWarmup( ); - else if( num == CS_STAGES ) + else if( num == CS_ALIEN_STAGES ) { stage_t oldAlienStage = cgs.alienStage; - stage_t oldHumanStage = cgs.humanStage; - sscanf( str, "%d %d %d %d %d %d", - &cgs.alienStage, &cgs.humanStage, - &cgs.alienCredits, &cgs.humanCredits, - &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold ); + if( str[0] ) + { + sscanf( str, "%d %d %d", &cgs.alienStage, &cgs.alienCredits, + &cgs.alienNextStageThreshold ); + + if( cgs.alienStage != oldAlienStage ) + CG_AnnounceAlienStageTransistion( oldAlienStage, cgs.alienStage ); + } + else + { + cgs.alienStage = cgs.alienCredits = cgs.alienNextStageThreshold = 0; + } + } + else if( num == CS_HUMAN_STAGES ) + { + stage_t oldHumanStage = cgs.humanStage; - if( cgs.alienStage != oldAlienStage ) - CG_AnnounceAlienStageTransistion( oldAlienStage, cgs.alienStage ); + if( str[0] ) + { + sscanf( str, "%d %d %d", &cgs.humanStage, &cgs.humanCredits, + &cgs.humanNextStageThreshold ); - if( cgs.humanStage != oldHumanStage ) - CG_AnnounceHumanStageTransistion( oldHumanStage, cgs.humanStage ); + if( cgs.humanStage != oldHumanStage ) + CG_AnnounceHumanStageTransistion( oldHumanStage, cgs.humanStage ); + } + else + { + cgs.humanStage = cgs.humanCredits = cgs.humanNextStageThreshold = 0; + } } else if( num == CS_LEVEL_START_TIME ) cgs.levelStartTime = atoi( str ); @@ -895,7 +930,7 @@ static void CG_Say( int clientNum, char *text ) "%s: " S_COLOR_WHITE S_COLOR_GREEN "%s" S_COLOR_WHITE "\n", ci->name, text ); - if( BG_ClientListTest( &cgs.ignoreList, clientNum ) ) + if( Com_ClientListContains( &cgs.ignoreList, clientNum ) ) CG_Printf( "[skipnotify]%s", sayText ); else CG_Printf( "%s", sayText ); @@ -919,7 +954,7 @@ static void CG_SayTeam( int clientNum, char *text ) "%s: " S_COLOR_CYAN "%s" S_COLOR_WHITE "\n", ci->name, text ); - if( BG_ClientListTest( &cgs.ignoreList, clientNum ) ) + if( Com_ClientListContains( &cgs.ignoreList, clientNum ) ) CG_Printf( "[skipnotify]%s", sayText ); else CG_Printf( "%s", sayText ); @@ -1042,7 +1077,7 @@ static void CG_ParseVoice( void ) return; // don't play audio track for lamers - if( BG_ClientListTest( &cgs.ignoreList, clientNum ) ) + if( Com_ClientListContains( &cgs.ignoreList, clientNum ) ) return; switch( vChan ) |