diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_cmds.c | 5 | ||||
-rw-r--r-- | src/game/g_main.c | 38 |
2 files changed, 32 insertions, 11 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index b382c28a..26367e83 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -496,6 +496,11 @@ void Cmd_Team_f( gentity_t *ent ) else team = PTE_ALIENS + ( rand( ) % 2 ); } + else + { + trap_SendServerCommand( ent-g_entities, va( "print \"Unknown team: %s\n\"", s ) ); + return; + } G_ChangeTeam( ent, team ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 5283ff35..4b2aa39d 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1051,6 +1051,29 @@ void G_CalculateStages( void ) /* ============ +CalculateAvgPlayers + +Calculates the average number of players playing this game +============ +*/ +void G_CalculateAvgPlayers( void ) +{ + //calculate average number of clients for stats + level.averageNumAlienClients = + ( ( level.averageNumAlienClients * level.numAlienSamples ) + + level.numAlienClients ) / + (float)( level.numAlienSamples + 1 ); + level.numAlienSamples++; + + level.averageNumHumanClients = + ( ( level.averageNumHumanClients * level.numHumanSamples ) + + level.numHumanClients ) / + (float)( level.numHumanSamples + 1 ); + level.numHumanSamples++; +} + +/* +============ CalculateRanks Recalculates the score ranks of all players @@ -1129,17 +1152,6 @@ void CalculateRanks( void ) } } - //calculate average number of clients for stats - level.averageNumAlienClients = - ( ( level.averageNumAlienClients * level.numAlienSamples ) - + level.numAlienClients ) / - (float)( ++level.numAlienSamples ); - - level.averageNumHumanClients = - ( ( level.averageNumHumanClients * level.numHumanSamples ) - + level.numHumanClients ) / - (float)( ++level.numHumanSamples ); - qsort( level.sortedClients, level.numConnectedClients, sizeof( level.sortedClients[ 0 ] ), SortRanks ); @@ -1590,6 +1602,9 @@ void CheckExitRules( void ) if( level.time - level.startTime >= g_timelimit.integer * 60000 ) { trap_SendServerCommand( -1, "print \"Timelimit hit.\n\"" ); + G_LogPrintf( "STATS T:L A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients, + level.averageNumHumanClients, + s, level.time - level.startTime ); LogExit( "Timelimit hit." ); return; } @@ -1938,6 +1953,7 @@ void G_RunFrame( int levelTime ) G_CalculateStages( ); G_SpawnClients( PTE_ALIENS ); G_SpawnClients( PTE_HUMANS ); + G_CalculateAvgPlayers( ); // see if it is time to end the level CheckExitRules( ); |