X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=pr_cmds.c;h=dca3e92786e0d2843a751be7f98c8f205a174645;hp=57851749d27c1529518850de7dfe65a59ebf582d;hb=d20520d58745196f7bbae40976698a30ece9ef0b;hpb=998540f27a05f0cfebff1539cbe170c9e17006e4 diff --git a/pr_cmds.c b/pr_cmds.c index 57851749..dca3e927 100644 --- a/pr_cmds.c +++ b/pr_cmds.c @@ -2218,15 +2218,21 @@ void PF_setcolor (void) } client = svs.clients + entnum-1; - if ((val = GETEDICTFIELDVALUE(client->edict, eval_clientcolors))) - val->_float = i; + if (client->edict) + { + if ((val = GETEDICTFIELDVALUE(client->edict, eval_clientcolors))) + val->_float = i; + client->edict->v->team = (i & 15) + 1; + } client->colors = i; - client->old_colors = i; - client->edict->v->team = (i & 15) + 1; - - MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors); - MSG_WriteByte (&sv.reliable_datagram, entnum - 1); - MSG_WriteByte (&sv.reliable_datagram, i); + if (client->old_colors != client->colors) + { + client->old_colors = client->colors; + // send notification to all clients + MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors); + MSG_WriteByte (&sv.reliable_datagram, client->number); + MSG_WriteByte (&sv.reliable_datagram, client->colors); + } } /*