summaryrefslogtreecommitdiff
path: root/src/game/g_cmds.c
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2009-10-03 12:34:36 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:05 +0000
commit0e2ab7aa3b0ff0d598967ae38a016e312a0aa58b (patch)
tree7297137505a7eb2120e29a2d73de0ce579504ad2 /src/game/g_cmds.c
parent35e262d005e1dee8b17229bb00ee4c5d70b6d03d (diff)
* Silence compiler warnings from r1160
* Fix improper behavior of console chat command * Fix console say/chat/say_team commands not being logged * Add teamPrefix to log/console print of say_team messages * Minor cleanups to chat logging code
Diffstat (limited to 'src/game/g_cmds.c')
-rw-r--r--src/game/g_cmds.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index eb001457..deb45159 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -695,7 +695,7 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons
// specs with ADMF_SPEC_ALLCHAT flag can see team chat
}
- if( BG_ClientListTest( &other->client->sess.ignoreList, ent-g_entities ) )
+ if( ent && BG_ClientListTest( &other->client->sess.ignoreList, ent-g_entities ) )
ignore = qtrue;
trap_SendServerCommand( other-g_entities, va( "%s \"%s%s%c%c%s%s\"",
@@ -715,7 +715,7 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
char text[ MAX_SAY_TEXT ];
char location[ 64 ];
- if( g_chatTeamPrefix.integer )
+ if( ent && g_chatTeamPrefix.integer )
{
prefix = BG_TeamName( ent->client->pers.teamSelection );
prefix = va( "[%c] ", toupper( *prefix ) );
@@ -727,14 +727,20 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
{
default:
case SAY_ALL:
- G_LogPrintf( "say: %s^7: %s\n", ent->client->pers.netname, chatText );
+ G_LogPrintf( "say: %s%s^7: " S_COLOR_GREEN "%s\n", prefix,
+ ( ent ) ? ent->client->pers.netname : "console", chatText );
Com_sprintf( name, sizeof( name ), "%s%s" S_COLOR_WHITE ": ", prefix,
- ent->client->pers.netname );
+ ( ent ) ? ent->client->pers.netname : "console" );
color = COLOR_GREEN;
break;
case SAY_TEAM:
- G_LogPrintf( "sayteam: %s^7: %s\n", ent->client->pers.netname, chatText );
+ // console say_team is handled in g_svscmds, not here
+ if( !ent || !ent->client )
+ Com_Error( ERR_FATAL, "SAY_TEAM by non-client entity\n" );
+
+ G_LogPrintf( "sayteam: %s%s^7: " S_COLOR_CYAN "%s\n", prefix,
+ ent->client->pers.netname, chatText );
if( Team_GetLocationMsg( ent, location, sizeof( location ) ) )
Com_sprintf( name, sizeof( name ), "(%s" S_COLOR_WHITE ") (%s): ",
ent->client->pers.netname, location );
@@ -748,10 +754,10 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
if( target && OnSameTeam( target, ent ) &&
Team_GetLocationMsg( ent, location, sizeof( location ) ) )
Com_sprintf( name, sizeof( name ), "[%s" S_COLOR_WHITE "] (%s): ",
- ent->client->pers.netname, location );
+ ( ent ) ? ent->client->pers.netname : "console", location );
else
Com_sprintf( name, sizeof( name ), "[%s" S_COLOR_WHITE "]: ",
- ent->client->pers.netname );
+ ( ent ) ? ent->client->pers.netname : "console" );
color = COLOR_MAGENTA;
break;
}