Freeciv-3.3
|
#include <math.h>
#include "fcintl.h"
#include "log.h"
#include "support.h"
#include "capability.h"
#include "connection.h"
#include "packets.h"
#include "player.h"
#include "commands.h"
#include "console.h"
#include <hand_gen.h>
#include "notify.h"
#include "settings.h"
#include "stdinhand.h"
#include "voting.h"
Go to the source code of this file.
Variables | |
struct vote_list * | vote_list = NULL |
int | vote_number_sequence = 0 |
void cancel_connection_votes | ( | struct connection * | pconn | ) |
Cancel the votes of a lost or a detached connection.
Definition at line 691 of file voting.c.
Referenced by connection_detach().
Check if we satisfy the criteria for resolving a vote, and resolve it if these critera are indeed met. Updates yes and no variables in voting struct as well.
Definition at line 420 of file voting.c.
Referenced by connection_vote(), remove_vote_cast(), and voting_turn().
Remove all votes. Sends vote_remove packets to clients.
Definition at line 219 of file voting.c.
Referenced by cancelvote_command(), start_game(), and voting_free().
Usually, all users can see, except in the team vote case.
Definition at line 272 of file voting.c.
Referenced by lsend_vote_new(), lsend_vote_resolve(), lsend_vote_update(), send_remove_team_votes(), send_running_votes(), and show_votes().
A user cannot vote if: is not connected access level < basic isn't a player the vote is a team vote and not on the caller's team NB: If 'pvote' is NULL, then the team condition is not checked.
Definition at line 248 of file voting.c.
Referenced by check_vote(), connection_vote(), count_voters(), handle_stdin_input_real(), vote_command(), vote_new(), and vote_would_pass_immediately().
Make the given connection vote 'type' on 'pvote', and check the vote.
Definition at line 663 of file voting.c.
Referenced by handle_stdin_input_real(), handle_vote_submit(), and vote_command().
Helper function that returns the current number of eligible voters.
Definition at line 48 of file voting.c.
Referenced by check_vote(), send_running_votes(), send_updated_vote_totals(), show_votes(), vote_new(), and vote_would_pass_immediately().
Fills the supplied buffer with a string describing the given vote. This includes the vote command line, the percent required to pass, and any special conditions.
Definition at line 748 of file voting.c.
Referenced by handle_stdin_input_real(), and lsend_vote_new().
Free all memory used by the vote structure.
Definition at line 189 of file voting.c.
Referenced by clear_all_votes(), and remove_vote().
struct vote * get_vote_by_caller | ( | const struct connection * | caller | ) |
Returns the vote called by 'caller', or NULL if none exists.
Definition at line 319 of file voting.c.
Referenced by cancel_connection_votes(), cancelvote_command(), handle_stdin_input_real(), and vote_new().
Returns the vote with vote number 'vote_no', or NULL.
Definition at line 301 of file voting.c.
Referenced by cancelvote_command(), handle_vote_submit(), and vote_command().
void handle_vote_submit | ( | struct connection * | pconn, |
int | vote_no, | ||
int | value | ||
) |
Handle a vote submit packet sent from a client. This is basically just a Wrapper around connection_vote().
Definition at line 775 of file voting.c.
Referenced by server_handle_packet().
Tell clients that a new vote has been created.
Definition at line 64 of file voting.c.
Referenced by send_running_votes(), and vote_new().
Tell clients that the given vote no longer exists.
Definition at line 140 of file voting.c.
Referenced by clear_all_votes(), remove_vote(), and send_remove_team_votes().
Tell clients that the given vote resolved.
Definition at line 162 of file voting.c.
Referenced by check_vote().
|
static |
Send updated status information about the given vote.
Definition at line 102 of file voting.c.
Referenced by check_vote(), send_running_votes(), and send_updated_vote_totals().
Remove the given vote and send a vote_remove packet to clients.
Definition at line 205 of file voting.c.
Referenced by cancel_connection_votes(), cancelvote_command(), check_vote(), and vote_new().
Remove a vote cast. This unlinks it and frees its memory.
Definition at line 649 of file voting.c.
Referenced by cancel_connection_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.
Definition at line 841 of file voting.c.
Referenced by connection_detach().
void send_running_votes | ( | struct connection * | pconn, |
bool | only_team_votes | ||
) |
Sends a packet_vote_new to pconn for every currently running votes.
Definition at line 810 of file voting.c.
Referenced by connection_attach_real(), and establish_new_connection().
Sends a packet_vote_update to every conn in dest. If dest is NULL, then sends to all established connections.
Definition at line 866 of file voting.c.
Referenced by close_connection(), connection_attach_real(), connection_detach(), kill_dying_players(), and server_remove_player().
Find the vote cast for the user id conn_id in a vote.
Definition at line 611 of file voting.c.
Referenced by cancel_connection_votes(), and connection_vote().
Returns the connection that called this vote.
Definition at line 891 of file voting.c.
Referenced by cancelvote_command(), check_vote(), conn_can_see_vote(), and conn_can_vote().
Returns TRUE if this vote is a "teamvote".
Definition at line 235 of file voting.c.
Referenced by check_vote(), conn_can_see_vote(), conn_can_vote(), handle_stdin_input_real(), send_remove_team_votes(), send_running_votes(), and show_votes().
Create and return a newly allocated vote for the command with id 'command_id' and all arguments in the string 'allargs'.
Definition at line 338 of file voting.c.
Referenced by handle_stdin_input_real().
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.
Definition at line 391 of file voting.c.
Referenced by handle_stdin_input_real().
Free all memory used by this module.
Definition at line 734 of file voting.c.
Referenced by server_quit().
Initialize data structures used by this module.
Definition at line 707 of file voting.c.
Referenced by srv_prepare().
Check running votes. This should be called every turn.
Definition at line 718 of file voting.c.
Referenced by end_turn().
Definition at line 41 of file voting.c.
Referenced by cancel_connection_votes(), cancelvote_command(), clear_all_votes(), get_vote_by_caller(), get_vote_by_no(), remove_vote(), send_remove_team_votes(), send_running_votes(), send_updated_vote_totals(), show_votes(), vote_command(), vote_new(), voting_free(), voting_init(), and voting_turn().
int vote_number_sequence = 0 |
Definition at line 42 of file voting.c.
Referenced by vote_command(), vote_new(), and voting_init().