blob: 3341edea2ada1c6a700c06b26474aca306cd7c3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#include <game/client/component.hpp>
#include <game/client/ui.hpp>
extern "C"
{
#include <engine/e_memheap.h>
}
class VOTING : public COMPONENT
{
HEAP *heap;
static void con_callvote(void *result, void *user_data);
static void con_vote(void *result, void *user_data);
int64 closetime;
char description[512];
char command[512];
int voted;
void clearoptions();
void callvote(const char *type, const char *value);
public:
struct VOTEOPTION
{
VOTEOPTION *next;
VOTEOPTION *prev;
char command[1];
};
VOTEOPTION *first;
VOTEOPTION *last;
VOTING();
virtual void on_reset();
virtual void on_console_init();
virtual void on_message(int msgtype, void *rawmsg);
virtual void on_render();
void render_bars(RECT bars, bool text);
void callvote_kick(int client_id);
void callvote_option(int option);
void vote(int v); // -1 = no, 1 = yes
int seconds_left() { return (closetime - time_get())/time_freq(); }
bool is_voting() { return closetime != 0; }
int taken_choice() const { return voted; }
const char *vote_description() const { return description; }
const char *vote_command() const { return command; }
int yes, no, pass, total;
};
|