diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-12-08 00:06:28 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:23 +0000 |
commit | c30d1b0c4fdd96979b616b67eda9d96aae37209a (patch) | |
tree | 87b5d460ae8b097ba4c7f41f403ede6baee8be0a /src | |
parent | 9040fbd03fee6f5d098abd49518a0a85ea9f65a2 (diff) |
* Add a EndVote: line to games.log for showing vote results (Rezyn)
* Add additional coloured versions of client names to games.log in ClientConnect and ClientRename lines for use by Tremstats et. al. (Rezyn)
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_client.c | 12 | ||||
-rw-r--r-- | src/game/g_cmds.c | 26 | ||||
-rw-r--r-- | src/game/g_local.h | 5 | ||||
-rw-r--r-- | src/game/g_main.c | 10 |
4 files changed, 47 insertions, 6 deletions
diff --git a/src/game/g_client.c b/src/game/g_client.c index 1dad4acd..d8858de9 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1070,8 +1070,10 @@ void ClientUserinfoChanged( int clientNum ) { trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " renamed to %s" S_COLOR_WHITE "\n\"", oldname, client->pers.netname ) ); - G_LogPrintf( "ClientRename: %i [%s] (%s) \"%s^7\" -> \"%s^7\"\n", clientNum, - client->pers.ip, client->pers.guid, oldname, client->pers.netname ); + G_LogPrintf( "ClientRename: %i [%s] (%s) \"%s^7\" -> \"%s^7\" \"%c%s%c^7\"\n", + clientNum, client->pers.ip, client->pers.guid, + oldname, client->pers.netname, + DECOLOR_OFF, client->pers.netname, DECOLOR_ON ); G_admin_namelog_update( client, qfalse ); } } @@ -1276,8 +1278,10 @@ char *ClientConnect( int clientNum, qboolean firstTime ) // get and distribute relevent paramters ClientUserinfoChanged( clientNum ); - G_LogPrintf( "ClientConnect: %i [%s] (%s) \"%s^7\"\n", clientNum, - client->pers.ip, client->pers.guid, client->pers.netname ); + G_LogPrintf( "ClientConnect: %i [%s] (%s) \"%s^7\" \"%c%s%c^7\"\n", + clientNum, client->pers.ip, client->pers.guid, + client->pers.netname, + DECOLOR_OFF, client->pers.netname, DECOLOR_ON ); // don't do the "xxx connected" messages if they were caried over from previous level if( firstTime ) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 1816b8f5..d2bf150e 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -3151,10 +3151,18 @@ void G_ListCommands( gentity_t *ent ) void G_DecolorString( char *in, char *out, int len ) { + qboolean decolor = qtrue; + len--; while( *in && len > 0 ) { - if( Q_IsColorString( in ) ) { + if( *in == DECOLOR_OFF || *in == DECOLOR_ON ) + { + decolor = ( *in == DECOLOR_ON ); + in++; + continue; + } + if( Q_IsColorString( in ) && decolor ) { in += 2; continue; } @@ -3164,6 +3172,22 @@ void G_DecolorString( char *in, char *out, int len ) *out = '\0'; } +void G_UnEscapeString( char *in, char *out, int len ) +{ + len--; + + while( *in && len > 0 ) + { + if( *in >= ' ' || *in == '\n' ) + { + *out++ = *in; + len--; + } + in++; + } + *out = '\0'; +} + void Cmd_PrivateMessage_f( gentity_t *ent ) { int pids[ MAX_CLIENTS ]; diff --git a/src/game/g_local.h b/src/game/g_local.h index d2b482ff..b317bba9 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -666,6 +666,10 @@ char *G_NewString( const char *string ); // // g_cmds.c // + +#define DECOLOR_OFF '\16' +#define DECOLOR_ON '\17' + void G_StopFollowing( gentity_t *ent ); void G_StopFromFollowing( gentity_t *ent ); void G_FollowLockView( gentity_t *ent ); @@ -677,6 +681,7 @@ int G_ClientNumbersFromString( char *s, int *plist, int max ); char *ConcatArgs( int start ); void G_Say( gentity_t *ent, saymode_t mode, const char *chatText ); void G_DecolorString( char *in, char *out, int len ); +void G_UnEscapeString( char *in, char *out, int len ); void G_SanitiseString( char *in, char *out, int len ); void Cmd_PrivateMessage_f( gentity_t *ent ); void Cmd_ListMaps_f( gentity_t *ent ); diff --git a/src/game/g_main.c b/src/game/g_main.c index c956b9a5..16c11ec7 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1673,7 +1673,10 @@ void QDECL G_LogPrintf( const char *fmt, ... ) va_end( argptr ); if( g_dedicated.integer ) - G_Printf( "%s", string + 7 ); + { + G_UnEscapeString( string, decolored, sizeof( decolored ) ); + G_Printf( "%s", decolored + 7 ); + } if( !level.logFile ) return; @@ -2122,6 +2125,11 @@ void G_CheckVote( team_t team ) if( pass ) level.voteExecuteTime[ team ] = level.time + 3000; + G_LogPrintf( "EndVote: %s %s %d %d %d\n", + team == TEAM_NONE ? "global" : BG_TeamName( team ), + pass ? "pass" : "fail", + level.voteYes[ team ], level.voteNo[ team ], level.numVotingClients[ team ] ); + msg = va( "print \"%sote %sed (%d - %d)\n\"", team == TEAM_NONE ? "V" : "Team v", pass ? "pass" : "fail", level.voteYes[ team ], level.voteNo[ team ] ); |