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

Function callvotepacket

source/src/server.cpp:2698–2747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2696}
2697
2698void callvotepacket (int cn, voteinfo *v = curvote)
2699{ // FIXME, it would be far smart if the msg buffer from SV_CALLVOTE was simply saved
2700 int n_yes = 0, n_no = 0;
2701 loopv(clients) if(clients[i]->type!=ST_EMPTY)
2702 {
2703 if ( clients[i]->vote == VOTE_YES ) n_yes++;
2704 else if ( clients[i]->vote == VOTE_NO ) n_no++;
2705 }
2706
2707 packetbuf q(MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
2708 putint(q, SV_CALLVOTE);
2709 putint(q, -1);
2710 putint(q, v->owner);
2711 putint(q, n_yes);
2712 putint(q, n_no);
2713 putint(q, v->type);
2714 switch(v->type)
2715 {
2716 case SA_KICK:
2717 case SA_BAN:
2718 putint(q, v->num1);
2719 sendstring(v->text, q);
2720 break;
2721 case SA_MAP:
2722 sendstring(v->text, q);
2723 putint(q, v->num1);
2724 putint(q, v->num2);
2725 break;
2726 case SA_SERVERDESC:
2727 sendstring(v->text, q);
2728 break;
2729 case SA_STOPDEMO:
2730 // compatibility
2731 break;
2732 case SA_REMBANS:
2733 case SA_SHUFFLETEAMS:
2734 break;
2735 case SA_FORCETEAM:
2736 putint(q, v->num1);
2737 putint(q, v->num2);
2738 break;
2739 case SA_PAUSE:
2740 putint(q, v->num1);
2741 break;
2742 default:
2743 putint(q, v->num1);
2744 break;
2745 }
2746 sendpacket(cn, 1, q.finalize());
2747}
2748
2749void changeclientrole(int client, int role, char *pwd, bool force)
2750{

Callers 2

scallvoteFunction · 0.85
processFunction · 0.85

Calls 5

putintFunction · 0.85
sendstringFunction · 0.85
sendpacketFunction · 0.85
finalizeMethod · 0.80
loopvFunction · 0.70

Tested by

no test coverage detected