36 #define SPECLIST_TAG vote_cast
37 #define SPECLIST_TYPE struct vote_cast
39 #define vote_cast_list_iterate(alist, pvc) \
40 TYPED_LIST_ITERATE(struct vote_cast, alist, pvc)
41 #define vote_cast_list_iterate_end LIST_ITERATE_END
57 #define SPECLIST_TAG vote
58 #define SPECLIST_TYPE struct vote
60 #define vote_list_iterate(alist, pvote) \
61 TYPED_LIST_ITERATE(struct vote, alist, pvote)
62 #define vote_list_iterate_end LIST_ITERATE_END
76 const struct vote *pvote);
struct vote_cast_list * votes_cast
void send_running_votes(struct connection *pconn, bool only_team_votes)
Sends a packet_vote_new to pconn for every currently running votes.
void send_remove_team_votes(struct connection *pconn)
Sends a packet_vote_remove to pconn for every currently running team vote 'pconn' can see.
int describe_vote(struct vote *pvote, char *buf, int buflen)
Fills the supplied buffer with a string describing the given vote.
struct vote * vote_new(struct connection *caller, const char *allargs, int command_id)
Create and return a newly allocated vote for the command with id 'command_id' and all arguments in th...
void voting_turn()
Check running votes.
bool conn_can_vote(const struct connection *pconn, const struct vote *pvote)
A user cannot vote if: is not connected access level < basic isn't a player the vote is a team vote a...
const struct connection * vote_get_caller(const struct vote *pvote)
Returns the connection that called this vote.
bool vote_is_team_only(const struct vote *pvote)
Returns TRUE if this vote is a "teamvote".
void cancel_connection_votes(struct connection *pconn)
Cancel the votes of a lost or a detached connection.
bool vote_would_pass_immediately(const struct connection *caller, int command_id)
Return whether the vote would pass immediately when the caller will vote for.
void send_updated_vote_totals(struct conn_list *dest)
Sends a packet_vote_update to every conn in dest.
void voting_free()
Free all memory used by this module.
void connection_vote(struct connection *pconn, struct vote *pvote, enum vote_type type)
Make the given connection vote 'type' on 'pvote', and check the vote.
struct vote_list * vote_list
struct vote * get_vote_by_caller(const struct connection *caller)
Returns the vote called by 'caller', or nullptr if none exists.
int count_voters(const struct vote *pvote)
Helper function that returns the current number of eligible voters.
void clear_all_votes()
Remove all votes.
void voting_init()
Initialize data structures used by this module.
void remove_vote(struct vote *pvote)
Remove the given vote and send a vote_remove packet to clients.
struct vote * get_vote_by_no(int vote_no)
Returns the vote with vote number 'vote_no', or nullptr.
bool conn_can_see_vote(const struct connection *pconn, const struct vote *pvote)
Usually, all users can see, except in the team vote case.