326 if (
pvote->caller_id == caller->
id) {
364 pvote->turn_count = 0;
450 switch (
pvc->vote_cast) {
464 log_error(
"Unknown vote cast variant: %d.",
pvc->vote_cast);
469 need_pc =
pvote->need_pc;
472 if (num_voters > 0) {
519 log_debug(
"check_vote flags=%d need_pc=%0.2f yes_pc=%0.2f "
520 "no_pc=%0.2f rem_pc=%0.2f base=%0.2f resolve=%d",
551 _(
"%s %d \"%s\" is passed %d to %d with "
552 "%d abstentions and %d who did not vote."),
558 _(
"%s %d \"%s\" failed with %d against, %d for, "
559 "%d abstentions and %d who did not vote."),
568 log_error(
"Got a vote from a lost connection");
571 log_error(
"Got a vote from a non-voting connection");
575 switch (
pvc->vote_cast) {
578 _(
"%s %d: %s voted yes."),
583 _(
"%s %d: %s voted no."),
588 _(
"%s %d: %s chose to abstain."),
681 log_error(
"Failed to create a vote cast for connection %s.",
721 log_error(
"voting_turn() called before voting_init()");
758 _(
"%s (needs %0.0f%% and no dissent)."),
764 _(
"%s (needs %0.0f%% in favor)."),
780 log_debug(
"Got vote submit (%d %d) from %s.",
787 log_verbose(
"Submit request for unknown vote_no %d from %s ignored.",
794 }
else if (value == -1) {
796 }
else if (value == 0) {
799 log_error(
"Invalid packet data for submit of vote %d "
819 log_debug(
"Sending %s running votes to %s.",
850 log_debug(
"Sending remove info of the team votes to %s.",
874 log_debug(
"Sending updated vote totals to conn_list %p", dest);
const char * command_name(const struct command *pcommand)
int command_vote_percent(const struct command *pcommand)
const struct command * command_by_number(int i)
int command_vote_flags(const struct command *pcommand)
struct player * conn_get_player(const struct connection *pconn)
void conn_list_do_unbuffer(struct conn_list *dest)
void conn_list_do_buffer(struct conn_list *dest)
void connection_do_buffer(struct connection *pc)
bool conn_controls_player(const struct connection *pconn)
bool conn_is_global_observer(const struct connection *pconn)
const char * conn_description(const struct connection *pconn)
struct connection * conn_by_number(int id)
enum cmdlevel conn_get_access(const struct connection *pconn)
void connection_do_unbuffer(struct connection *pc)
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
#define MAX_LEN_CONSOLE_LINE
static void base(QVariant data1, QVariant data2)
const struct ft_color ftc_vote_abstain
const struct ft_color ftc_vote_failed
const struct ft_color ftc_vote_yes
const struct ft_color ftc_vote_no
const struct ft_color ftc_vote_passed
#define log_verbose(message,...)
#define fc_assert(condition)
#define log_debug(message,...)
#define log_error(message,...)
void notify_team(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
int send_packet_vote_resolve(struct connection *pc, const struct packet_vote_resolve *packet)
int send_packet_vote_remove(struct connection *pc, const struct packet_vote_remove *packet)
int send_packet_vote_update(struct connection *pc, const struct packet_vote_update *packet)
int send_packet_vote_new(struct connection *pc, const struct packet_vote_new *packet)
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
bool handle_stdin_input(struct connection *caller, char *str)
struct conn_list * est_connections
int fc_snprintf(char *str, size_t n, const char *format,...)
#define sz_strlcpy(dest, src)
#define sz_strlcat(dest, src)
void send_running_votes(struct connection *pconn, bool only_team_votes)
static void lsend_vote_new(struct conn_list *dest, struct vote *pvote)
void send_remove_team_votes(struct connection *pconn)
int describe_vote(struct vote *pvote, char *buf, int buflen)
static void lsend_vote_remove(struct conn_list *dest, struct vote *pvote)
bool conn_can_vote(const struct connection *pconn, const struct vote *pvote)
static void check_vote(struct vote *pvote)
struct vote * vote_new(struct connection *caller, const char *allargs, int command_id)
bool vote_is_team_only(const struct vote *pvote)
void cancel_connection_votes(struct connection *pconn)
struct vote * get_vote_by_no(int vote_no)
bool vote_would_pass_immediately(const struct connection *caller, int command_id)
void send_updated_vote_totals(struct conn_list *dest)
void handle_vote_submit(struct connection *pconn, int vote_no, int value)
static void lsend_vote_resolve(struct conn_list *dest, struct vote *pvote, bool passed)
void clear_all_votes(void)
struct vote * get_vote_by_caller(const struct connection *caller)
static void lsend_vote_update(struct conn_list *dest, struct vote *pvote, int num_voters)
static void free_vote(struct vote *pvote)
static struct vote_cast * vote_cast_find(struct vote *pvote, int conn_id)
void connection_vote(struct connection *pconn, struct vote *pvote, enum vote_type type)
struct vote_list * vote_list
const struct connection * vote_get_caller(const struct vote *pvote)
int count_voters(const struct vote *pvote)
static void remove_vote_cast(struct vote *pvote, struct vote_cast *pvc)
void remove_vote(struct vote *pvote)
static struct vote_cast * vote_cast_new(struct vote *pvote)
bool conn_can_see_vote(const struct connection *pconn, const struct vote *pvote)
#define vote_list_iterate_end
#define vote_cast_list_iterate(alist, pvc)
#define vote_list_iterate(alist, pvote)
#define vote_cast_list_iterate_end