summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-04-18 09:48:49 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-04-18 09:48:49 +0200
commit1d0e74c7e3aad55aa127a6e712ee865ce8e12e54 (patch)
tree2e739bb40acb169fdd749869b9203c9ec2353f6a
parentadabd56276c47fcec73c845ad9b7424f84074c52 (diff)
Better !namelog format.
-rw-r--r--src/game/g_admin.c66
1 files changed, 22 insertions, 44 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 79dfb71..8b2be68 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -6956,54 +6956,32 @@ qboolean G_admin_nextmap( gentity_t *ent, int skiparg )
return qtrue;
}
-const char *displaySchachtmeisterJudgement( const schachtmeisterJudgement_t *j )
-{
- char pc, ps;
- static char display[ MAX_STRING_CHARS ];
-
- if( j->queryTime )
- {
- if( level.time - j->queryTime >= 60000 )
- pc = '0', ps = 'X'; // dead, apparently
- else if( level.time - j->queryTime >= 10000 )
- pc = '4', ps = 'z'; // asleep, apparently
- else
- pc = '5', ps = ','; // wait
- }
- else
- pc = '7', ps = ' '; // stfu, compiler
- if( j->ratingTime )
- {
- char rc, rs;
+static const char *displaySchachtmeisterJudgement(const schachtmeisterJudgement_t *j,
+ g_admin_namelog_t *namelog)
+{
+ static char buffer[20];
- if( j->rating >= g_schachtmeisterClearThreshold.integer )
- rc = '2', rs = 'o';
- else if( j->rating <= g_schachtmeisterAutobahnThreshold.integer )
- rc = '1', rs = '!';
- else
- rc = '3', rs = '?';
+ if (strcmp(namelog->guid, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") &&
+ (G_admin_permission_guid(namelog->guid, ADMF_NOAUTOBAHN) ||
+ G_admin_permission_guid(namelog->guid, ADMF_IMMUNITY))) {
+ Com_sprintf(buffer, sizeof(buffer), "^7 N/A ");
+ } else if (!j->ratingTime) {
+ Com_sprintf(buffer, sizeof(buffer), "^5 wait");
+ } else {
+ int color;
- if( j->queryTime )
- Com_sprintf( display, sizeof( display ), "^%c%c^%c%c ^%c% 4i", rc, rs, pc, ps, rc, j->rating );
- else
- Com_sprintf( display, sizeof( display ), "^%c%c % 4i", rc, rs, j->rating );
+ if (j->rating >= g_schachtmeisterClearThreshold.integer)
+ color = 2;
+ else if (j->rating <= g_schachtmeisterAutobahnThreshold.integer)
+ color = 1;
+ else
+ color = 3;
- if( j->comment )
- {
- int l = strlen( display );
- Com_sprintf( display + l, sizeof( display ) - l, " (%s)", j->comment );
- }
- }
- else
- {
- if( j->queryTime )
- Com_sprintf( display, sizeof( display ), " ^%c%c", pc, ps );
- else // shouldn't happen
- display[ 0 ] = '\0';
- }
+ Com_sprintf(buffer, sizeof(buffer), "^%i%+5i", color, j->rating);
+ }
- return display;
+ return buffer;
}
qboolean G_admin_namelog( gentity_t *ent, int skiparg )
@@ -7050,7 +7028,7 @@ qboolean G_admin_namelog( gentity_t *ent, int skiparg )
(g_admin_namelog[ i ]->slot > -1 ) ?
va( "%d", g_admin_namelog[ i ]->slot ) : "-",
guid_stub, g_admin_namelog[ i ]->ip,
- displaySchachtmeisterJudgement( &g_admin_namelog[ i ]->smj ) ) );
+ displaySchachtmeisterJudgement( &g_admin_namelog[ i ]->smj, g_admin_namelog[ i ] ) ) );
for( j = 0; j < MAX_ADMIN_NAMELOG_NAMES &&
g_admin_namelog[ i ]->name[ j ][ 0 ]; j++ )
{