MCPcopy Index your code
hub / github.com/assaultcube/AC / sendteamtext

Function sendteamtext

source/src/server.cpp:1757–1776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1755// c) no spect talk to players during 'match'
1756
1757void sendteamtext(char *text, int sender, int msgtype)
1758{
1759 if(!valid_client(sender) || clients[sender]->team == TEAM_NUM) return;
1760 packetbuf p(MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
1761 putint(p, msgtype);
1762 putint(p, sender);
1763 sendstring(text, p);
1764 ENetPacket *packet = p.finalize();
1765 recordpacket(1, packet);
1766 int &st = clients[sender]->team;
1767 loopv(clients)
1768 {
1769 int &rt = clients[i]->team;
1770 if((rt == TEAM_SPECT && clients[i]->role == CR_ADMIN) || // spect-admin reads all
1771 (team_isactive(st) && st == team_group(rt)) || // player to own team + own spects
1772 (team_isspect(st) && team_isspect(rt)) || // spectator to other spectators
1773 (i == sender)) // "local" echo
1774 sendpacket(i, 1, packet);
1775 }
1776}
1777
1778void sendvoicecomteam(int sound, int sender)
1779{

Callers 1

processFunction · 0.85

Calls 5

valid_clientFunction · 0.85
putintFunction · 0.85
sendstringFunction · 0.85
recordpacketFunction · 0.85
finalizeMethod · 0.80

Tested by

no test coverage detected