![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <ctime>#include "log.h"#include "packets.h"#include "voteinfo_bar_g.h"#include "client_main.h"#include "options.h"#include "voteinfo.h"#include "speclist.h"
Include dependency graph for voteinfo.cpp:Go to the source code of this file.
Macros | |
| #define | SPECLIST_TAG voteinfo |
| #define | SPECLIST_TYPE struct voteinfo |
| #define | voteinfo_list_iterate(alist, pitem) TYPED_LIST_ITERATE(struct voteinfo, alist, pitem) |
| #define | voteinfo_list_iterate_end LIST_ITERATE_END |
Functions | |
| void | voteinfo_queue_delayed_remove (int vote_no) |
| Remove the vote with number 'vote_no' after a small amount of time so that the user can see that it was removed. More... | |
| void | voteinfo_queue_check_removed () |
| Check for old votes that should be removed from the queue. More... | |
| void | voteinfo_queue_remove (int vote_no) |
| Remove the given vote from the queue immediately. More... | |
| void | voteinfo_queue_add (int vote_no, const char *user, const char *desc, int percent_required, int flags) |
| Create a new voteinfo record and place it in the queue. More... | |
| struct voteinfo * | voteinfo_queue_find (int vote_no) |
| Find the voteinfo record corresponding to the given vote number. More... | |
| void | voteinfo_queue_init () |
| Initialize data structures used by this module. More... | |
| void | voteinfo_queue_free () |
| Free memory allocated by this module. More... | |
| struct voteinfo * | voteinfo_queue_get_current (int *pindex) |
| Get the voteinfo record at the start of the vote queue. More... | |
| void | voteinfo_do_vote (int vote_no, enum client_vote_type vote) |
| Convenience function for submitting a vote to the server. More... | |
| void | voteinfo_queue_next () |
| Cycle through the votes in the queue. More... | |
| int | voteinfo_queue_size () |
| Returns the number of pending votes. More... | |
Variables | |
| static struct voteinfo_list * | voteinfo_queue = nullptr |
| static int | voteinfo_queue_current_index = 0 |
| #define SPECLIST_TAG voteinfo |
Definition at line 32 of file voteinfo.cpp.
| #define SPECLIST_TYPE struct voteinfo |
Definition at line 33 of file voteinfo.cpp.
| #define voteinfo_list_iterate | ( | alist, | |
| pitem | |||
| ) | TYPED_LIST_ITERATE(struct voteinfo, alist, pitem) |
Definition at line 35 of file voteinfo.cpp.
| #define voteinfo_list_iterate_end LIST_ITERATE_END |
Definition at line 37 of file voteinfo.cpp.
| void voteinfo_do_vote | ( | int | vote_no, |
| enum client_vote_type | vote | ||
| ) |
Convenience function for submitting a vote to the server.
NB: Only to be used if the server has the "voteinfo" capability.
Definition at line 231 of file voteinfo.cpp.
Referenced by pregamevote::v_abstain(), pregamevote::v_no(), and pregamevote::v_yes().
| void voteinfo_queue_add | ( | int | vote_no, |
| const char * | user, | ||
| const char * | desc, | ||
| int | percent_required, | ||
| int | flags | ||
| ) |
Create a new voteinfo record and place it in the queue.
Definition at line 117 of file voteinfo.cpp.
Referenced by handle_vote_new().
| void voteinfo_queue_check_removed | ( | ) |
Check for old votes that should be removed from the queue.
This function should be called periodically from a timer callback.
Definition at line 65 of file voteinfo.cpp.
Referenced by real_timer_callback().
| void voteinfo_queue_delayed_remove | ( | int | vote_no | ) |
Remove the vote with number 'vote_no' after a small amount of time so that the user can see that it was removed.
Definition at line 46 of file voteinfo.cpp.
Referenced by handle_vote_remove().
| struct voteinfo* voteinfo_queue_find | ( | int | vote_no | ) |
Find the voteinfo record corresponding to the given vote number.
Definition at line 144 of file voteinfo.cpp.
Referenced by handle_vote_new(), handle_vote_resolve(), handle_vote_update(), voteinfo_do_vote(), voteinfo_queue_delayed_remove(), and voteinfo_queue_remove().
| void voteinfo_queue_free | ( | ) |
Free memory allocated by this module.
Definition at line 175 of file voteinfo.cpp.
Referenced by client_game_free(), and voteinfo_queue_init().
| struct voteinfo* voteinfo_queue_get_current | ( | int * | pindex | ) |
Get the voteinfo record at the start of the vote queue.
If 'pindex' is non-nullptr, it is set to queue index of that record. This function is used in conjunction with voteinfo_queue_next().
Definition at line 198 of file voteinfo.cpp.
Referenced by pregamevote::update_vote(), pregamevote::v_abstain(), pregamevote::v_no(), and pregamevote::v_yes().
| void voteinfo_queue_init | ( | ) |
Initialize data structures used by this module.
Definition at line 163 of file voteinfo.cpp.
Referenced by client_game_init().
| void voteinfo_queue_next | ( | ) |
Cycle through the votes in the queue.
Definition at line 269 of file voteinfo.cpp.
Referenced by voteinfo_queue_get_current().
| void voteinfo_queue_remove | ( | int | vote_no | ) |
Remove the given vote from the queue immediately.
Definition at line 97 of file voteinfo.cpp.
Referenced by voteinfo_queue_check_removed().
| int voteinfo_queue_size | ( | ) |
Returns the number of pending votes.
Definition at line 288 of file voteinfo.cpp.
Referenced by pregamevote::update_vote().
|
static |
Definition at line 39 of file voteinfo.cpp.
Referenced by voteinfo_queue_add(), voteinfo_queue_check_removed(), voteinfo_queue_delayed_remove(), voteinfo_queue_find(), voteinfo_queue_free(), voteinfo_queue_get_current(), voteinfo_queue_init(), voteinfo_queue_next(), voteinfo_queue_remove(), and voteinfo_queue_size().
|
static |
Definition at line 40 of file voteinfo.cpp.
Referenced by voteinfo_queue_add(), voteinfo_queue_free(), voteinfo_queue_get_current(), voteinfo_queue_init(), and voteinfo_queue_next().