ddnet/src/game/client/components/voting.h
GreYFoX 0df6d0541f Merge branch 'master' of git://github.com/oy/teeworlds into HEAD
Conflicts:
	bam.lua
	src/engine/console.h
	src/engine/server.h
	src/engine/server/server.cpp
	src/engine/shared/config.h
	src/engine/shared/config_variables.h
	src/engine/shared/console.cpp
	src/engine/shared/console.h
	src/game/client/components/binds.cpp
	src/game/client/components/chat.h
	src/game/client/components/console.cpp
	src/game/client/components/console.h
	src/game/client/components/controls.cpp
	src/game/client/components/emoticon.h
	src/game/client/components/maplayers.cpp
	src/game/client/components/menus.h
	src/game/client/components/scoreboard.h
	src/game/client/components/spectator.h
	src/game/client/components/voting.h
	src/game/client/gameclient.cpp
	src/game/client/gameclient.h
	src/game/client/render.h
	src/game/collision.cpp
	src/game/editor/ed_layer_tiles.cpp
	src/game/gamecore.cpp
	src/game/gamecore.h
	src/game/layers.cpp
	src/game/layers.h
	src/game/mapitems.h
	src/game/server/entities/character.cpp
	src/game/server/entities/laser.cpp
	src/game/server/entities/laser.h
	src/game/server/entities/pickup.cpp
	src/game/server/entities/pickup.h
	src/game/server/entities/projectile.cpp
	src/game/server/gamecontext.cpp
	src/game/server/gamecontroller.cpp
	src/game/server/gamecontroller.h
	src/game/server/gameworld.cpp
	src/game/server/gameworld.h
	src/game/server/player.cpp
	src/game/variables.h
2011-04-14 01:27:49 +02:00

61 lines
1.9 KiB
C++

/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef GAME_CLIENT_COMPONENTS_VOTING_H
#define GAME_CLIENT_COMPONENTS_VOTING_H
#include <engine/shared/memheap.h>
#include <game/voting.h>
#include <game/client/component.h>
#include <game/client/ui.h>
class CVoting : public CComponent
{
CHeap m_Heap;
static void ConCallvote(IConsole::IResult *pResult, void *pUserData, int ClientID);
static void ConVote(IConsole::IResult *pResult, void *pUserData, int ClientID);
int64 m_Closetime;
char m_aDescription[VOTE_DESC_LENGTH];
char m_aReason[VOTE_REASON_LENGTH];
int m_Voted;
int m_Yes, m_No, m_Pass, m_Total;
void AddOption(const char *pDescription);
void ClearOptions();
void Callvote(const char *pType, const char *pValue, const char *pReason);
public:
int m_NumVoteOptions;
CVoteOptionClient *m_pFirst;
CVoteOptionClient *m_pLast;
CVoteOptionClient *m_pRecycleFirst;
CVoteOptionClient *m_pRecycleLast;
CVoting();
virtual void OnReset();
virtual void OnConsoleInit();
virtual void OnMessage(int Msgtype, void *pRawMsg);
virtual void OnRender();
void RenderBars(CUIRect Bars, bool Text);
void CallvoteSpectate(int ClientID, const char *pReason, bool ForceVote = false);
void CallvoteKick(int ClientID, const char *pReason, bool ForceVote = false);
void CallvoteOption(int OptionID, const char *pReason, bool ForceVote = false);
void RemovevoteOption(int OptionID);
void AddvoteOption(const char *pDescription, const char *pCommand);
void Vote(int v); // -1 = no, 1 = yes
int SecondsLeft() { return (m_Closetime - time_get())/time_freq(); }
bool IsVoting() { return m_Closetime != 0; }
int TakenChoice() const { return m_Voted; }
const char *VoteDescription() const { return m_aDescription; }
const char *VoteReason() const { return m_aReason; }
};
#endif