From f5c4bc00cf6307c14a6037a1f0a68259e4fe2ac8 Mon Sep 17 00:00:00 2001 From: enneract Date: Sat, 20 Dec 2014 19:06:32 +0100 Subject: Improve the output of /stats. --- src/game/g_admin.c | 15 +++++++++++---- src/game/g_combat.c | 3 ++- src/game/g_local.h | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 2cb622c..c407788 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -4443,14 +4443,21 @@ qboolean G_admin_stats( gentity_t *ent ) CSW_MAX_NAME_LEN, "Weapon" ) ); } - ADMBP( va( "%*s", CSW_MAX_NAME_LEN, cswNames[ i ] ) ); + ADMBP( va( "^3%*s", CSW_MAX_NAME_LEN, cswNames[ i ] ) ); for( j = CSD_FIRST; j < CSD_MAX; j++ ) { if( ranks->inuse[ j ] ) - ADMBP( va( " ^7%3d ^1%3d", - MIN( (int)round( ranks->effs[ j ] * 100.0f ), 999 ), - (int)round( ranks->effs_pc[ j ] * 100.0f ) ) ); + { + ADMBP( va( " ^7%3d", + MIN( (int)round( ranks->effs[ j ] * 100.0f ), 999 ) ) ); + + if( ranks->ranked[ j ] ) + ADMBP( va( " ^1%3d", + (int)round( ranks->effs_pc[ j ] * 100.0f ) ) ); + else + ADMBP( " ^0n/a" ); + } else ADMBP( " ^0--- ---" ); } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index a40f7a7..7713d2a 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -1940,7 +1940,7 @@ void G_CalculateCombatRanks( void ) samples[ sample_count++ ].value = ranks->effs[ dmgtype ]; } - if( !sample_count ) + if( sample_count < 2 ) continue; qsort( samples, sample_count, sizeof( csrSample_t ), (int(*)(const void*,const void*))csrSampleCmp ); @@ -1952,6 +1952,7 @@ void G_CalculateCombatRanks( void ) if( i > 0 && fabs( last - samples[ i ].value ) > 1.0e-5 ) rank++; + ranks->ranked[ dmgtype ] = qtrue; ranks->effs_pc[ dmgtype ] = rank; last = samples[ i ].value; diff --git a/src/game/g_local.h b/src/game/g_local.h index 4819388..a98d818 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -336,6 +336,7 @@ typedef struct typedef struct { qboolean inuse[ CSD_MAX ]; + qboolean ranked[ CSD_MAX ]; float effs[ CSD_MAX ]; float effs_pc[ CSD_MAX ]; } combatRanks_t; -- cgit