summaryrefslogtreecommitdiff
path: root/src/game/g_main.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2004-05-27 21:43:24 +0000
committerTim Angus <tim@ngus.net>2004-05-27 21:43:24 +0000
commit2ee76d11bb34641e021f69b3509da5c62e7afdb0 (patch)
treee1c45796114c1c66ca8cd0fed0a007d841637e8f /src/game/g_main.c
parent8f6fba34633ee7039655cb60497c3d71c629b2ff (diff)
* Added code to calculate the average number of players that are playing
* Added stats on game end to aid balancing * "itemact <weaponname>" now selects a weapon as well as activating an upgrade * Disabled chat balloon entirely
Diffstat (limited to 'src/game/g_main.c')
-rw-r--r--src/game/g_main.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 0fd433b7..5283ff35 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1129,6 +1129,17 @@ 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 );
@@ -1549,8 +1560,11 @@ can see the last frag.
*/
void CheckExitRules( void )
{
- int i;
+ int i;
gclient_t *cl;
+ char s[ MAX_STRING_CHARS ];
+
+ trap_Cvar_VariableStringBuffer( "mapname", s, sizeof( s ) );
// if at the intermission, wait for all non-bots to
// signal ready, then go to next level
@@ -1589,6 +1603,10 @@ void CheckExitRules( void )
//humans win
level.lastWin = PTE_HUMANS;
trap_SendServerCommand( -1, "print \"Humans win.\n\"");
+ G_LogPrintf( "STATS T:H A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients,
+ level.averageNumHumanClients,
+ s, level.time - level.startTime );
+
LogExit( "Humans win." );
return;
}
@@ -1599,6 +1617,10 @@ void CheckExitRules( void )
//aliens win
level.lastWin = PTE_ALIENS;
trap_SendServerCommand( -1, "print \"Aliens win.\n\"");
+ G_LogPrintf( "STATS T:A A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients,
+ level.averageNumHumanClients,
+ s, level.time - level.startTime );
+
LogExit( "Aliens win." );
return;
}