diff options
author | M. Kristall <mkpdev@gmail.com> | 2012-07-13 01:20:54 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:18:17 +0000 |
commit | c78e04f4c834d88dbada2e961e65b43c7bfbf424 (patch) | |
tree | 7348a70d38933bb3e4978778d616bc02edccdc72 /src/cgame | |
parent | 22f97fece2bce63f57e0b8fca275281429705c9c (diff) |
* Smarter way to check if teamoverlay info should be sent; don't send upgrade
field for aliens
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_servercmds.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 64ef7985..dff02805 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -81,24 +81,31 @@ static void CG_ParseTeamInfo( void ) int i; int count; int client; + int fields; - count = ( trap_Argc( ) - 1 ) / 5; + if( cg.snap->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) + fields = 4; // aliens don't have upgrades + else + fields = 5; + + count = ( trap_Argc( ) - 1 ) / fields; cgs.teaminfoReceievedTime = cg.time; for( i = 0; i < count; i++ ) { - client = atoi( CG_Argv( i * 5 + 1 ) ); + client = atoi( CG_Argv( i * fields + 1 ) ); if( client < 0 || client >= MAX_CLIENTS ) { CG_Printf( "[skipnotify]CG_ParseTeamInfo: bad client number: %d\n", client ); return; } - cgs.clientinfo[ client ].location = atoi( CG_Argv( i * 5 + 2 ) ); - cgs.clientinfo[ client ].health = atoi( CG_Argv( i * 5 + 3 ) ); - cgs.clientinfo[ client ].curWeaponClass = atoi( CG_Argv( i * 5 + 4 ) ); - cgs.clientinfo[ client ].upgrade = atoi( CG_Argv( i * 5 + 5 ) ); + cgs.clientinfo[ client ].location = atoi( CG_Argv( i * fields + 2 ) ); + cgs.clientinfo[ client ].health = atoi( CG_Argv( i * fields + 3 ) ); + cgs.clientinfo[ client ].curWeaponClass = atoi( CG_Argv( i * fields + 4 ) ); + if( cg.snap->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + cgs.clientinfo[ client ].upgrade = atoi( CG_Argv( i * fields + 5 ) ); } } |