Changed the server logging to be more like a normal AQ server. Cleaned

all colors from the logs.
This commit is contained in:
Richard Allen 2002-04-30 01:23:05 +00:00
parent 650cdbc586
commit 30bddfb909
5 changed files with 70 additions and 25 deletions

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.69 2002/04/30 01:23:05 jbravo
// Changed the server logging to be more like a normal AQ server. Cleaned
// all colors from the logs.
//
// Revision 1.68 2002/04/23 00:21:44 jbravo
// Cleanups of the new model code. Removed the spectator bar for zcam modes.
//
@ -1077,7 +1081,8 @@ void ClientUserinfoChanged( int clientNum ) {
trap_SetConfigstring( CS_PLAYERS+clientNum, s );
G_LogPrintf( "ClientUserinfoChanged: %i %s\n", clientNum, s );
// JBravo: ugly in the logs. Enable to debug if necessary
// G_LogPrintf( "ClientUserinfoChanged: %i %s\n", clientNum, s );
}
/*
===========
@ -1187,7 +1192,7 @@ restarts.
============
*/
char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {
char *value;
char *value, *ip;
gclient_t *client;
char userinfo[MAX_INFO_STRING];
gentity_t *ent;
@ -1196,8 +1201,8 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {
trap_GetUserinfo(clientNum, userinfo, sizeof(userinfo));
// check to see if they are on the banned IP list
value = Info_ValueForKey (userinfo, "ip");
if (G_FilterPacket(value)) {
ip = Info_ValueForKey (userinfo, "ip");
if (G_FilterPacket(ip)) {
return "Banned.";
}
@ -1238,7 +1243,8 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {
}
// get and distribute relevent paramters
G_LogPrintf( "ClientConnect: %i\n", clientNum );
// JBravo: make this more like AQ. Moved it down a bit.
// G_LogPrintf( "ClientConnect: %i\n", clientNum );
// slicer : make sessionTeam = to savedTeam for scoreboard on cgame
// JBravo: only for teamplay. Could break DM
@ -1252,6 +1258,7 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {
// don't do the "xxx connected" messages if they were caried over from previous level
if (firstTime) {
trap_SendServerCommand(-1, va("print \"%s" S_COLOR_WHITE " connected\n\"", client->pers.netname));
G_LogPrintf( "%s@%s connected (clientNum %i)\n", client->pers.netname, ip, clientNum );
}
if (g_gametype.integer >= GT_TEAM && g_gametype.integer != GT_TEAMPLAY &&
@ -1827,7 +1834,9 @@ void ClientDisconnect( int clientNum ) {
}
G_LogPrintf( "ClientDisconnect: %i\n", clientNum );
// JBravo: Make this more like AQ
// G_LogPrintf( "ClientDisconnect: %i\n", clientNum );
G_LogPrintf( "%s disconnected (clientNum %i)\n", ent->client->pers.netname, clientNum );
// if we are playing in tourney mode and losing, give a win to the other player
if ( (g_gametype.integer == GT_TOURNAMENT )

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.99 2002/04/30 01:23:05 jbravo
// Changed the server logging to be more like a normal AQ server. Cleaned
// all colors from the logs.
//
// Revision 1.98 2002/04/28 11:03:46 slicer
// Added "teammodel" for Matchmode, Referee "pause" command
//
@ -1235,10 +1239,8 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
case SAY_ALL:
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) {
Com_sprintf (name, sizeof(name), "[DEAD] %s%c%c"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
// G_LogPrintf( "[DEAD] %s: %s\n", ent->client->pers.netname, chatText );
} else {
Com_sprintf (name, sizeof(name), "%s%c%c"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
// G_LogPrintf( "%s: %s\n", ent->client->pers.netname, chatText );
}
color = COLOR_GREEN;
break;
@ -1246,7 +1248,6 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) {
Com_sprintf (name, sizeof(name), EC"[DEAD] (%s%c%c"EC")"EC": ",
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
// G_LogPrintf( "[DEAD] (%s): %s\n", ent->client->pers.netname, chatText );
} else {
if (Team_GetLocationMsg(ent, location, sizeof(location)))
Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC") (%s)"EC": ",
@ -1254,7 +1255,6 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
else
Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC")"EC": ",
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
// G_LogPrintf( "(%s): %s\n", ent->client->pers.netname, chatText );
}
color = COLOR_CYAN;
break;
@ -1290,6 +1290,9 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
G_Printf( "%s%s\n", name, text);
}
// JBravo: Log it like AQ does
G_LogPrintf ("%s%s\n", name, text);
// send it to all the apropriate clients
for (j = 0; j < level.maxclients; j++) {
other = &g_entities[j];

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.34 2002/04/30 01:23:05 jbravo
// Changed the server logging to be more like a normal AQ server. Cleaned
// all colors from the logs.
//
// Revision 1.33 2002/04/05 18:53:26 jbravo
// Warning fixes
//
@ -816,7 +820,8 @@ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
}
//Elder: Moved after checks so we don't print a billion log messages
G_LogPrintf( "Item: %i %s\n", other->s.number, ent->item->classname );
// JBravo: removed.
// G_LogPrintf( "Item: %i %s\n", other->s.number, ent->item->classname );
// play the normal pickup sound
if (predict) {

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.49 2002/04/30 01:23:05 jbravo
// Changed the server logging to be more like a normal AQ server. Cleaned
// all colors from the logs.
//
// Revision 1.48 2002/04/28 23:13:08 jbravo
// Clean up the server logs
//
@ -276,7 +280,7 @@ static cvarTable_t gameCvarTable[] = {
{ &g_warmup, "g_warmup", "20", CVAR_ARCHIVE, 0, qtrue },
{ &g_doWarmup, "g_doWarmup", "0", 0, 0, qtrue },
{ &g_log, "g_log", "games.log", CVAR_ARCHIVE, 0, qfalse },
{ &g_log, "g_log", "reaction.log", CVAR_ARCHIVE, 0, qfalse },
{ &g_logSync, "g_logSync", "0", CVAR_ARCHIVE, 0, qfalse },
{ &g_password, "g_password", "", CVAR_USERINFO, 0, qfalse },
@ -1430,33 +1434,45 @@ Print to the logfile with a time stamp if it is open
void QDECL G_LogPrintf( const char *fmt, ... ) {
va_list argptr;
char string[1024];
int min, tens, sec;
int min, tens, sec, i, l;
sec = level.time / 1000;
min = sec / 60;
sec -= min * 60;
tens = sec / 10;
sec -= tens * 10;
Com_sprintf( string, sizeof(string), "%3i:%i%i ", min, tens, sec );
l = i = 0;
va_start( argptr, fmt );
vsprintf( string +7 , fmt,argptr );
va_end( argptr );
Com_sprintf (string, sizeof(string), "%3i:%i%i ", min, tens, sec);
// JBravo: damn colors fsck up the logs and make them ugly.
Q_CleanStr (string);
va_start (argptr, fmt);
vsprintf (string +7, fmt, argptr);
va_end (argptr);
if ( g_dedicated.integer ) {
G_Printf( "%s", string + 7 );
if (g_dedicated.integer) {
G_Printf ("%s", string + 7);
}
if ( !level.logFile ) {
if (!level.logFile) {
return;
}
trap_FS_Write( string, strlen( string ), level.logFile );
// JBravo: damn colors fsck up the logs and make them ugly.
for (i = 0; string[i]; i++) {
if (Q_IsColorString (&string[i])) {
i++;
continue;
}
if (string[i] > 0x7E)
continue;
if (string[i] == 0x19)
continue;
string[l++] = string[i];
}
string[l] = '\0';
trap_FS_Write (string, strlen(string), level.logFile);
}
/*

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.69 2002/04/30 01:23:05 jbravo
// Changed the server logging to be more like a normal AQ server. Cleaned
// all colors from the logs.
//
// Revision 1.68 2002/04/29 10:58:07 jbravo
// My lights sound fix broke the scoreboard removal on round begins.
//
@ -378,6 +382,7 @@ void StartLCA()
CleanLevel();
trap_Cvar_Set("g_RQ3_lca", "1");
level.lights_camera_action = (41*level.fps)/10;
G_LogPrintf ("LIGHTS...\n");
SpawnPlayers();
// trap_SendServerCommand( -1, "lights");
}
@ -385,9 +390,11 @@ void StartLCA()
void ContinueLCA()
{
if (level.lights_camera_action == (21*level.fps)/10) {
G_LogPrintf ("CAMERA...\n");
trap_SendServerCommand( -1, "camera");
}
else if (level.lights_camera_action == 1) {
G_LogPrintf ("ACTION!\n");
trap_SendServerCommand( -1, "action");
trap_Cvar_Set("g_RQ3_lca", "0");
level.team_round_going = 1;
@ -535,15 +542,19 @@ int CheckForForcedWinner()
int WonGame(int winner)
{
trap_SendServerCommand( -1, "print \"The round is over:\n\"" );
G_LogPrintf ("The round is over:\n");
if (winner == WINNER_TIE) {
trap_SendServerCommand( -1, "print \"It was a tie, no points awarded!\n\"" );
G_LogPrintf ("It was a tie, no points awarded!\n");
} else {
if (winner == WINNER_TEAM1) {
trap_SendServerCommand( -1, va("print \"%s won!\n\"", g_RQ3_team1name.string));
G_LogPrintf ("%s won!\n", g_RQ3_team1name.string);
level.teamScores[TEAM_RED]++;
} else {
trap_SendServerCommand( -1, va("print \"%s won!\n\"", g_RQ3_team2name.string));
G_LogPrintf ("%s won!\n", g_RQ3_team2name.string);
level.teamScores[TEAM_BLUE]++;
}
}
@ -1613,7 +1624,8 @@ void RQ3_Cmd_Use_f(gentity_t *ent)
if (weapon == ent->client->ps.weapon)
return;
Com_sprintf (buf, sizeof(buf), "weapon %d\n", weapon);
trap_SendConsoleCommand(EXEC_APPEND, buf);
// trap_SendConsoleCommand(EXEC_APPEND, buf);
trap_SendServerCommand(EXEC_APPEND, buf);
}
void Add_TeamWound(gentity_t *attacker, gentity_t *victim, int mod)