1
0
Fork 0
forked from fte/fteqw

semifix to cl_standardmsg

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1475 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2005-10-16 03:47:32 +00:00
parent f024485827
commit 278e33f99e

View file

@ -3332,11 +3332,13 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
// CL_PrintStandardMessage: takes non-chat net messages and performs name coloring
// NOTE: msg is considered destroyable
char acceptedchars[] = {'.', '?', '!', '\'', ',', ':', ' ', '\0'};
void CL_PrintStandardMessage(char *msg)
{
int i;
player_info_t *p;
extern cvar_t cl_standardmsg;
char *begin = msg;
// search for player names in message
for (i = 0, p = cl.players; i < MAX_CLIENTS; p++, i++)
@ -3352,8 +3354,33 @@ void CL_PrintStandardMessage(char *msg)
name = Info_ValueForKey (p->userinfo, "name");
len = strlen(name);
v = strstr(msg, name);
if (v) // name found
while (v)
{
// name parsing rules
if (v != begin && *(v-1) != ' ') // must be space before name
{
v = strstr(NULL, name);
continue;
}
{
int i;
char aftername = *(v + len);
// search for accepted chars in char after name in msg
for (i = 0; i < sizeof(acceptedchars); i++)
{
if (acceptedchars[i] == aftername)
break;
}
if (sizeof(acceptedchars) == i)
{
v = strstr(NULL, name);
continue; // no accepted char found
}
}
*v = 0; // cut off message
con_ormask = 0;
// print msg chunk
@ -3372,6 +3399,7 @@ void CL_PrintStandardMessage(char *msg)
// print name
con_ormask = ormask;
Con_Printf("^%c%s^7", c, name);
break;
}
}