From f559c2d486ce3bab66a4f1c0601e934ee841a317 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sat, 22 Apr 2006 22:53:03 +0000 Subject: * Added P server side cvar, which lists the teams each client is on (from tjw) --- src/game/g_main.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/game/g_main.c b/src/game/g_main.c index e1cd7ec5..4a4fa2ca 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -119,6 +119,7 @@ static cvarTable_t gameCvarTable[ ] = { NULL, "gamedate", __DATE__ , CVAR_ROM, 0, qfalse }, { &g_restarted, "g_restarted", "0", CVAR_ROM, 0, qfalse }, { NULL, "sv_mapname", "", CVAR_SERVERINFO | CVAR_ROM, 0, qfalse }, + { NULL, "P", "", CVAR_SERVERINFO | CVAR_ROM, 0, qfalse }, // latched vars @@ -1143,6 +1144,7 @@ void CalculateRanks( void ) int score; int newScore; gclient_t *cl; + char P[ MAX_CLIENTS + 1 ] = {""}; level.follow1 = -1; level.follow2 = -1; @@ -1160,10 +1162,12 @@ void CalculateRanks( void ) for( i = 0; i < level.maxclients; i++ ) { + P[ i ] = '-'; if ( level.clients[ i ].pers.connected != CON_DISCONNECTED ) { level.sortedClients[ level.numConnectedClients ] = i; level.numConnectedClients++; + P[ i ] = (char)'0' + level.clients[ i ].ps.stats[ STAT_PTEAM ]; if( !( level.clients[ i ].ps.pm_flags & PMF_FOLLOW ) ) { @@ -1208,6 +1212,8 @@ void CalculateRanks( void ) } } } + P[ i + 1 ] = '\0'; + trap_Cvar_Set( "P", P ); qsort( level.sortedClients, level.numConnectedClients, sizeof( level.sortedClients[ 0 ] ), SortRanks ); -- cgit