OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ControlVoteEnd Class Referenceabstract

#include <C4Control.h>

Inheritance diagram for C4ControlVoteEnd:
[legend]
Collaboration diagram for C4ControlVoteEnd:
[legend]

Public Member Functions

 C4ControlVoteEnd (C4ControlVoteType eType=VT_None, bool fApprove=true, int iData=0)
 
virtual bool Sync () const
 
C4ControlVoteType getType () const
 
bool isApprove () const
 
int32_t getData () const
 
StdStrBuf getDesc () const
 
StdStrBuf getDescWarning () const
 
int32_t getByClient () const
 
bool LocalControl () const
 
bool HostControl () const
 
void SetByClient (int32_t iByClient)
 
virtual bool PreExecute () const
 
virtual void Execute () const =0
 
virtual void PreRec (C4Record *pRecord)
 
virtual bool Lobby () const
 
virtual void CompileFunc (StdCompiler *pComp)
 
C4NetIOPacket pack (const C4NetIO::addr_t &addr=C4NetIO::addr_t()) const
 
C4NetIOPacket pack (uint8_t cStatus, const C4NetIO::addr_t &addr=C4NetIO::addr_t()) const
 
void unpack (const C4NetIOPacket &Pkt, char *pStatus=nullptr)
 

Protected Attributes

int32_t iByClient
 

Detailed Description

Definition at line 602 of file C4Control.h.

Constructor & Destructor Documentation

C4ControlVoteEnd::C4ControlVoteEnd ( C4ControlVoteType  eType = VT_None,
bool  fApprove = true,
int  iData = 0 
)
inline

Definition at line 605 of file C4Control.h.

606  : C4ControlVote(eType, fApprove, iData)
607  { }
C4ControlVote(C4ControlVoteType eType=VT_None, bool fApprove=true, int iData=0)
Definition: C4Control.h:580

Member Function Documentation

void C4ControlPacket::CompileFunc ( StdCompiler pComp)
virtualinherited

Implements C4PacketBase.

Definition at line 77 of file C4Control.cpp.

References C4ControlPacket::iByClient, mkIntPackAdapt(), mkNamingAdapt(), and StdCompiler::Value().

78 {
79  // Section must be set by caller
80  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iByClient), "ByClient", -1));
81 }
int32_t iByClient
Definition: C4Control.h:39
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
void Value(const T &rStruct)
Definition: StdCompiler.h:171
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:760

Here is the call graph for this function:

virtual void C4ControlPacket::Execute ( ) const
pure virtualinherited

Referenced by C4GameControl::DoSyncCheck(), C4GameControl::ExecControlPacket(), and C4Control::Execute().

Here is the caller graph for this function:

int32_t C4ControlPacket::getByClient ( ) const
inlineinherited

Definition at line 42 of file C4Control.h.

References C4ControlPacket::iByClient.

Referenced by C4Network2::GetVote(), and C4Network2::OpenVoteDialog().

42 { return iByClient; }
int32_t iByClient
Definition: C4Control.h:39

Here is the caller graph for this function:

int32_t C4ControlVote::getData ( ) const
inlineinherited

Definition at line 592 of file C4Control.h.

Referenced by C4Network2::Execute(), C4Network2::GetVote(), and C4Network2::OpenVoteDialog().

592 { return iData; }

Here is the caller graph for this function:

StdStrBuf C4ControlVote::getDesc ( ) const
inherited

Definition at line 1687 of file C4Control.cpp.

References C4Game::Clients, StdStrBuf::Format(), Game, C4ClientList::getClientByID(), C4Client::getName(), C4ControlPacket::iByClient, LoadResStr(), VT_Cancel, VT_Kick, and VT_Pause.

Referenced by C4Network2::OpenVoteDialog().

1688 {
1689  // Describe action
1690  StdStrBuf Action;
1691  switch (eType)
1692  {
1693  case VT_Cancel:
1694  Action = LoadResStr("IDS_VOTE_CANCELTHEROUND"); break;
1695  case VT_Kick:
1696  if (iData == iByClient)
1697  Action = LoadResStr("IDS_VOTE_LEAVETHEGAME");
1698  else
1699  {
1700  C4Client *pTargetClient = Game.Clients.getClientByID(iData);
1701  Action.Format(LoadResStr("IDS_VOTE_KICKCLIENT"), pTargetClient ? pTargetClient->getName() : "???");
1702  }
1703  break;
1704  case VT_Pause:
1705  if (iData)
1706  Action = LoadResStr("IDS_TEXT_PAUSETHEGAME");
1707  else
1708  Action = LoadResStr("IDS_TEXT_UNPAUSETHEGAME");
1709  break;
1710  default:
1711  Action = "perform some mysterious action"; break;
1712  }
1713  return Action;
1714 }
C4Game Game
Definition: C4Globals.cpp:52
int32_t iByClient
Definition: C4Control.h:39
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:181
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4Client * getClientByID(int32_t iID) const
Definition: C4Client.cpp:217
const char * getName() const
Definition: C4Client.h:107
C4ClientList & Clients
Definition: C4Game.h:71

Here is the call graph for this function:

Here is the caller graph for this function:

StdStrBuf C4ControlVote::getDescWarning ( ) const
inherited

Definition at line 1716 of file C4Control.cpp.

References LoadResStr(), VT_Cancel, and VT_Kick.

Referenced by C4Network2::OpenVoteDialog().

1717 {
1718  StdStrBuf Warning;
1719  switch (eType)
1720  {
1721  case VT_Cancel:
1722  Warning = LoadResStr("IDS_TEXT_WARNINGIFTHEGAMEISCANCELL"); break;
1723  case VT_Kick:
1724  Warning = LoadResStr("IDS_TEXT_WARNINGNOLEAGUEPOINTSWILL"); break;
1725  default:
1726  Warning = ""; break;
1727  }
1728  return Warning;
1729 }
const char * LoadResStr(const char *id)
Definition: C4Language.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

C4ControlVoteType C4ControlVote::getType ( ) const
inlineinherited

Definition at line 590 of file C4Control.h.

Referenced by C4Network2::Execute(), C4Network2::GetVote(), and C4Network2::OpenVoteDialog().

590 { return eType; }

Here is the caller graph for this function:

bool C4ControlPacket::HostControl ( ) const
inlineinherited

Definition at line 44 of file C4Control.h.

References C4ClientIDHost.

44 { return iByClient == C4ClientIDHost; }
int32_t iByClient
Definition: C4Control.h:39
const int32_t C4ClientIDHost
Definition: C4Client.h:25
bool C4ControlVote::isApprove ( ) const
inlineinherited

Definition at line 591 of file C4Control.h.

591 { return fApprove; }
virtual bool C4ControlPacket::Lobby ( ) const
inlinevirtualinherited

Reimplemented in C4ControlMessage, C4ControlPlayerInfo, C4ControlClientRemove, C4ControlClientUpdate, C4ControlClientJoin, and C4ControlSet.

Definition at line 53 of file C4Control.h.

Referenced by C4GameControl::DoInput().

53 { return false; }

Here is the caller graph for this function:

bool C4ControlPacket::LocalControl ( ) const
inherited

Definition at line 67 of file C4Control.cpp.

References C4GameControl::ClientID(), Control, and C4ControlPacket::iByClient.

68 {
69  return iByClient == ::Control.ClientID();
70 }
int32_t iByClient
Definition: C4Control.h:39
C4GameControl Control
int32_t ClientID() const

Here is the call graph for this function:

C4NetIOPacket C4PacketBase::pack ( const C4NetIO::addr_t addr = C4NetIO::addr_t()) const
inherited

Definition at line 156 of file C4Packet2.cpp.

Referenced by MkC4NetIOPacket().

157 {
158  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(*this), addr);
159 }

Here is the caller graph for this function:

C4NetIOPacket C4PacketBase::pack ( uint8_t  cStatus,
const C4NetIO::addr_t addr = C4NetIO::addr_t() 
) const
inherited

Definition at line 161 of file C4Packet2.cpp.

References mkDecompileAdapt(), and mkInsertAdapt().

162 {
163  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(mkInsertAdapt(mkDecompileAdapt(*this), cStatus)), addr);
164 }
StdDecompileAdapt< T > mkDecompileAdapt(const T &rValue)
Definition: StdAdaptors.h:154
StdInsertAdapt< T, I > mkInsertAdapt(T &&rObj, I &&rIns, bool fBefore=true)
Definition: StdAdaptors.h:438

Here is the call graph for this function:

virtual bool C4ControlPacket::PreExecute ( ) const
inlinevirtualinherited

Reimplemented in C4ControlJoinPlayer.

Definition at line 48 of file C4Control.h.

Referenced by C4GameControl::ExecControlPacket(), and C4Control::PreExecute().

48 { return true; }

Here is the caller graph for this function:

virtual void C4ControlPacket::PreRec ( C4Record pRecord)
inlinevirtualinherited

Reimplemented in C4ControlJoinPlayer.

Definition at line 50 of file C4Control.h.

Referenced by C4Control::PreRec(), and C4Record::Rec().

50 { }

Here is the caller graph for this function:

void C4ControlPacket::SetByClient ( int32_t  iByClient)
inherited

Definition at line 72 of file C4Control.cpp.

References C4ControlPacket::iByClient.

73 {
74  iByClient = inByClient;
75 }
int32_t iByClient
Definition: C4Control.h:39
virtual bool C4ControlVoteEnd::Sync ( ) const
inlinevirtual

Reimplemented from C4ControlVote.

Definition at line 609 of file C4Control.h.

609 { return true; }
void C4PacketBase::unpack ( const C4NetIOPacket Pkt,
char *  pStatus = nullptr 
)
inherited

Definition at line 166 of file C4Packet2.cpp.

References C4NetIOPacket::getPBuf(), C4NetIOPacket::getRef(), and C4NetIOPacket::getStatus().

Referenced by C4IDPacket::C4IDPacket(), and C4Network2IO::HandlePacket().

167 {
168  if (pStatus) *pStatus = Pkt.getStatus();
169  CompileFromBuf<StdCompilerBinRead>(*this, pStatus ? Pkt.getPBuf() : Pkt.getRef());
170 }
StdBuf getPBuf() const
Definition: C4NetIO.h:321
C4NetIOPacket getRef() const
Definition: C4NetIO.h:324
uint8_t getStatus() const
Definition: C4NetIO.h:318

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int32_t C4ControlPacket::iByClient
protectedinherited

The documentation for this class was generated from the following file: