OpenClonk
C4ControlPlayerControl Class Referenceabstract

#include <C4Control.h>

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

Classes

struct  ControlItem
 

Public Types

typedef std::vector< ControlItemControlItemVec
 

Public Member Functions

 C4ControlPlayerControl ()=default
 
 C4ControlPlayerControl (int32_t iPlr, C4PlayerControl::ControlState state, const C4KeyEventData &rExtraData)
 
 C4ControlPlayerControl (int32_t iPlr, int32_t iControl, int32_t iExtraData)
 
DECLARE_C4CONTROL_VIRTUALS void AddControl (int32_t iControl, int32_t iTriggerMode)
 
const ControlItemVecGetControlItems () const
 
C4PlayerControl::ControlState GetState () const
 
const C4KeyEventDataGetExtraData () const
 
void SetExtraData (const C4KeyEventData &new_extra_data)
 
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 bool Sync () const
 
void CompileFunc (StdCompiler *pComp) override
 
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 iPlr {-1}
 
int32_t state {C4PlayerControl::CONS_Down}
 
C4KeyEventData ExtraData
 
ControlItemVec ControlItems
 
int32_t iByClient
 

Detailed Description

Definition at line 199 of file C4Control.h.

Member Typedef Documentation

◆ ControlItemVec

Definition at line 217 of file C4Control.h.

Constructor & Destructor Documentation

◆ C4ControlPlayerControl() [1/3]

C4ControlPlayerControl::C4ControlPlayerControl ( )
default

◆ C4ControlPlayerControl() [2/3]

C4ControlPlayerControl::C4ControlPlayerControl ( int32_t  iPlr,
C4PlayerControl::ControlState  state,
const C4KeyEventData rExtraData 
)
inline

Definition at line 203 of file C4Control.h.

204  : iPlr(iPlr), state(state), ExtraData(rExtraData) { }
C4KeyEventData ExtraData
Definition: C4Control.h:221

◆ C4ControlPlayerControl() [3/3]

C4ControlPlayerControl::C4ControlPlayerControl ( int32_t  iPlr,
int32_t  iControl,
int32_t  iExtraData 
)
inline

Definition at line 205 of file C4Control.h.

206  : iPlr(iPlr), state(C4PlayerControl::CONS_Down), ExtraData(iExtraData,0,0,0,0) { AddControl(iControl,0); }
DECLARE_C4CONTROL_VIRTUALS void AddControl(int32_t iControl, int32_t iTriggerMode)
Definition: C4Control.h:225

References AddControl().

Here is the call graph for this function:

Member Function Documentation

◆ AddControl()

DECLARE_C4CONTROL_VIRTUALS void C4ControlPlayerControl::AddControl ( int32_t  iControl,
int32_t  iTriggerMode 
)
inline

Definition at line 225 of file C4Control.h.

226  { ControlItems.emplace_back(iControl, iTriggerMode); }
ControlItemVec ControlItems
Definition: C4Control.h:222

References ControlItems.

Referenced by C4ControlPlayerControl(), and C4PlayerControl::PrepareInput().

Here is the caller graph for this function:

◆ CompileFunc()

void C4ControlPacket::CompileFunc ( StdCompiler pComp)
overridevirtualinherited

Implements C4PacketBase.

Definition at line 70 of file C4Control.cpp.

71 {
72  // Section must be set by caller
73  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iByClient), "ByClient", -1));
74 }
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:791
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
int32_t iByClient
Definition: C4Control.h:39
void Value(const T &rStruct)
Definition: StdCompiler.h:161

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

Here is the call graph for this function:

◆ Execute()

virtual void C4ControlPacket::Execute ( ) const
pure virtualinherited

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

Here is the caller graph for this function:

◆ getByClient()

int32_t C4ControlPacket::getByClient ( ) const
inlineinherited

Definition at line 42 of file C4Control.h.

42 { return iByClient; }

References C4ControlPacket::iByClient.

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

Here is the caller graph for this function:

◆ GetControlItems()

const ControlItemVec& C4ControlPlayerControl::GetControlItems ( ) const
inline

Definition at line 227 of file C4Control.h.

227 { return ControlItems; }

References ControlItems.

Referenced by C4PlayerControl::ExecuteControlPacket().

Here is the caller graph for this function:

◆ GetExtraData()

const C4KeyEventData& C4ControlPlayerControl::GetExtraData ( ) const
inline

Definition at line 229 of file C4Control.h.

229 { return ExtraData; }

References ExtraData.

Referenced by C4PlayerControl::ExecuteControlPacket().

Here is the caller graph for this function:

◆ GetState()

C4PlayerControl::ControlState C4ControlPlayerControl::GetState ( ) const
inline

Definition at line 228 of file C4Control.h.

228 { return static_cast<C4PlayerControl::ControlState>(state); }

References state.

Referenced by C4PlayerControl::ExecuteControlPacket().

Here is the caller graph for this function:

◆ HostControl()

bool C4ControlPacket::HostControl ( ) const
inlineinherited

Definition at line 44 of file C4Control.h.

44 { return iByClient == C4ClientIDHost; }
const int32_t C4ClientIDHost
Definition: C4Client.h:25

References C4ClientIDHost, and C4ControlPacket::iByClient.

◆ Lobby()

virtual bool C4ControlPacket::Lobby ( ) const
inlinevirtualinherited

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

Definition at line 53 of file C4Control.h.

53 { return false; }

Referenced by C4GameControl::DoInput().

Here is the caller graph for this function:

◆ LocalControl()

bool C4ControlPacket::LocalControl ( ) const
inherited

Definition at line 60 of file C4Control.cpp.

61 {
62  return iByClient == ::Control.ClientID();
63 }
C4GameControl Control
int32_t ClientID() const

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

Here is the call graph for this function:

◆ pack() [1/2]

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

Definition at line 150 of file C4Packet2.cpp.

151 {
152  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(*this), addr);
153 }

Referenced by MkC4NetIOPacket().

Here is the caller graph for this function:

◆ pack() [2/2]

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

Definition at line 155 of file C4Packet2.cpp.

156 {
157  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(mkInsertAdapt(mkDecompileAdapt(*this), cStatus)), addr);
158 }
StdInsertAdapt< T, I > mkInsertAdapt(T &&rObj, I &&rIns, bool fBefore=true)
Definition: StdAdaptors.h:469
StdDecompileAdapt< T > mkDecompileAdapt(const T &rValue)
Definition: StdAdaptors.h:153

References mkDecompileAdapt(), and mkInsertAdapt().

Here is the call graph for this function:

◆ PreExecute()

virtual bool C4ControlPacket::PreExecute ( ) const
inlinevirtualinherited

Reimplemented in C4ControlJoinPlayer.

Definition at line 48 of file C4Control.h.

48 { return true; }

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

Here is the caller graph for this function:

◆ PreRec()

virtual void C4ControlPacket::PreRec ( C4Record pRecord)
inlinevirtualinherited

Reimplemented in C4ControlJoinPlayer.

Definition at line 50 of file C4Control.h.

50 { }

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

Here is the caller graph for this function:

◆ SetByClient()

void C4ControlPacket::SetByClient ( int32_t  iByClient)
inherited

Definition at line 65 of file C4Control.cpp.

66 {
67  iByClient = inByClient;
68 }

References C4ControlPacket::iByClient.

◆ SetExtraData()

void C4ControlPlayerControl::SetExtraData ( const C4KeyEventData new_extra_data)
inline

Definition at line 230 of file C4Control.h.

230 { ExtraData = new_extra_data; }

References ExtraData.

◆ Sync()

virtual bool C4ControlPacket::Sync ( ) const
inlinevirtualinherited

Reimplemented in C4ControlVoteEnd, C4ControlVote, C4ControlMessage, C4ControlPlayerInfo, C4ControlClientRemove, C4ControlClientUpdate, C4ControlClientJoin, and C4ControlSyncCheck.

Definition at line 55 of file C4Control.h.

55 { return true; }

Referenced by C4Playback::Check(), and C4GameControl::DoInput().

Here is the caller graph for this function:

◆ unpack()

void C4PacketBase::unpack ( const C4NetIOPacket Pkt,
char *  pStatus = nullptr 
)
inherited

Definition at line 160 of file C4Packet2.cpp.

161 {
162  if (pStatus) *pStatus = Pkt.getStatus();
163  CompileFromBuf<StdCompilerBinRead>(*this, pStatus ? Pkt.getPBuf() : Pkt.getRef());
164 }
uint8_t getStatus() const
Definition: C4NetIO.h:319
StdBuf getPBuf() const
Definition: C4NetIO.h:322
C4NetIOPacket getRef() const
Definition: C4NetIO.h:325

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

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

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ ControlItems

ControlItemVec C4ControlPlayerControl::ControlItems
protected

Definition at line 222 of file C4Control.h.

Referenced by AddControl(), and GetControlItems().

◆ ExtraData

C4KeyEventData C4ControlPlayerControl::ExtraData
protected

Definition at line 221 of file C4Control.h.

Referenced by GetExtraData(), and SetExtraData().

◆ iByClient

◆ iPlr

int32_t C4ControlPlayerControl::iPlr {-1}
protected

Definition at line 219 of file C4Control.h.

◆ state

int32_t C4ControlPlayerControl::state {C4PlayerControl::CONS_Down}
protected

Definition at line 220 of file C4Control.h.

Referenced by GetState().


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