MCPcopy Create free account
hub / github.com/assaultcube/AC / svote

Function svote

source/src/server.cpp:2611–2628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2609static voteinfo *curvote = NULL;
2610
2611bool svote(int sender, int vote, ENetPacket *msg) // true if the vote was placed successfully
2612{
2613 if(!curvote || !valid_client(sender) || vote < VOTE_YES || vote > VOTE_NO) return false;
2614 if(clients[sender]->vote != VOTE_NEUTRAL)
2615 {
2616 sendf(sender, 1, "ri2", SV_CALLVOTEERR, VOTEE_MUL);
2617 return false;
2618 }
2619 else
2620 {
2621 sendpacket(-1, 1, msg, sender);
2622
2623 clients[sender]->vote = vote;
2624 mlog(ACLOG_DEBUG,"[%s] client %s voted %s", clients[sender]->hostname, clients[sender]->name, vote == VOTE_NO ? "no" : "yes");
2625 curvote->evaluate();
2626 return true;
2627 }
2628}
2629
2630void scallvotesuc(voteinfo *v)
2631{

Callers 1

processFunction · 0.85

Calls 5

valid_clientFunction · 0.85
sendfFunction · 0.85
sendpacketFunction · 0.85
mlogFunction · 0.85
evaluateMethod · 0.80

Tested by

no test coverage detected