From b746d797266c9fd4d4cb92845d98e611bb501605 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sat, 24 Mar 2007 13:06:14 +0000 Subject: * Minor efficiency/readability improvement to g_chatTeamPrefix code --- src/game/g_cmds.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index a139a9a8..cc8e0a5e 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -809,32 +809,34 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) { - int j; - gentity_t *other; - int color; - char prefix[ 5 ]; - char name[ 64 ]; + int j; + gentity_t *other; + int color; + const char *prefix; + char name[ 64 ]; // don't let text be too long for malicious reasons - char text[ MAX_SAY_TEXT ]; - char location[ 64 ]; + char text[ MAX_SAY_TEXT ]; + char location[ 64 ]; if (g_chatTeamPrefix.integer) + { switch( ent->client->pers.teamSelection) { default: case PTE_NONE: - Com_sprintf( prefix, sizeof( prefix ), "[S] "); + prefix = "[S] "; break; case PTE_ALIENS: - Com_sprintf( prefix, sizeof( prefix ), "[A] "); + prefix = "[A] "; break; case PTE_HUMANS: - Com_sprintf( prefix, sizeof( prefix ), "[H] "); + prefix = "[H] "; } + } else - prefix[ 0 ] = '\0'; + prefix = ""; switch( mode ) { -- cgit