OpenClonk
C4GameControlPacket Class Reference

#include <C4GameControlNetwork.h>

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

Public Member Functions

 C4GameControlPacket ()
 
 C4GameControlPacket (const C4GameControlPacket &Pkt2)
 
C4GameControlPacketoperator= (const C4GameControlPacket &Pkt2)
 
int32_t getClientID () const
 
int32_t getCtrlTick () const
 
C4TimeMilliseconds getTime () const
 
const C4ControlgetControl () const
 
void Set (int32_t iClientID, int32_t iCtrlTick)
 
void Set (int32_t iClientID, int32_t iCtrlTick, const C4Control &Ctrl)
 
void Add (const C4GameControlPacket &Ctrl)
 
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 iClientID
 
int32_t iCtrlTick {-1}
 
C4TimeMilliseconds tTime
 
C4Control Ctrl
 
C4GameControlPacketpNext {nullptr}
 

Friends

class C4GameControlNetwork
 

Detailed Description

Definition at line 172 of file C4GameControlNetwork.h.

Constructor & Destructor Documentation

◆ C4GameControlPacket() [1/2]

C4GameControlPacket::C4GameControlPacket ( )

Definition at line 849 of file C4GameControlNetwork.cpp.

852 {
853 
854 }
const int32_t C4ClientIDUnknown
Definition: C4Client.h:24
C4TimeMilliseconds tTime
static C4TimeMilliseconds Now()

◆ C4GameControlPacket() [2/2]

C4GameControlPacket::C4GameControlPacket ( const C4GameControlPacket Pkt2)

Definition at line 856 of file C4GameControlNetwork.cpp.

857  : C4PacketBase(Pkt2), iClientID(Pkt2.getClientID()),
858  iCtrlTick(Pkt2.getCtrlTick()),
860 {
861  Ctrl.Copy(Pkt2.getControl());
862 }
void Copy(const C4Control &Ctrl)
Definition: C4Control.h:86
int32_t getClientID() const
const C4Control & getControl() const
int32_t getCtrlTick() const

References C4Control::Copy(), Ctrl, and getControl().

Here is the call graph for this function:

Member Function Documentation

◆ Add()

void C4GameControlPacket::Add ( const C4GameControlPacket Ctrl)

Definition at line 883 of file C4GameControlNetwork.cpp.

884 {
885  Ctrl.Append(Ctrl2.getControl());
886 }
void Append(const C4Control &Ctrl)
Definition: C4Control.h:85

References C4Control::Append(), Ctrl, and getControl().

Referenced by C4GameControlNetwork::PackCompleteCtrl().

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

◆ CompileFunc()

void C4GameControlPacket::CompileFunc ( StdCompiler pComp)
overridevirtual

Implements C4PacketBase.

Definition at line 888 of file C4GameControlNetwork.cpp.

889 {
891  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iCtrlTick), "CtrlTick", -1));
892  pComp->Value(mkNamingAdapt(Ctrl, "Ctrl"));
893 }
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:791
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
void Value(const T &rStruct)
Definition: StdCompiler.h:161

References C4ClientIDUnknown, Ctrl, iClientID, iCtrlTick, mkIntPackAdapt(), mkNamingAdapt(), and StdCompiler::Value().

Here is the call graph for this function:

◆ getClientID()

int32_t C4GameControlPacket::getClientID ( ) const
inline

Definition at line 194 of file C4GameControlNetwork.h.

194 { return iClientID; }

References iClientID.

Referenced by C4GameControlNetwork::HandleControl(), and operator=().

Here is the caller graph for this function:

◆ getControl()

const C4Control& C4GameControlPacket::getControl ( ) const
inline

Definition at line 197 of file C4GameControlNetwork.h.

197 { return Ctrl; }

References Ctrl.

Referenced by Add(), C4GameControlPacket(), C4GameControlNetwork::CheckCompleteCtrl(), C4GameControlNetwork::ExecQueuedSyncCtrl(), C4GameControlNetwork::GetControl(), and operator=().

Here is the caller graph for this function:

◆ getCtrlTick()

int32_t C4GameControlPacket::getCtrlTick ( ) const
inline

Definition at line 195 of file C4GameControlNetwork.h.

195 { return iCtrlTick; }

References iCtrlTick.

Referenced by C4GameControlNetwork::CheckCompleteCtrl(), C4GameControlNetwork::ClearCtrl(), C4GameControlNetwork::ExecQueuedSyncCtrl(), C4GameControlNetwork::HandleControl(), C4GameControlNetwork::HandleControlReq(), and operator=().

Here is the caller graph for this function:

◆ getTime()

C4TimeMilliseconds C4GameControlPacket::getTime ( ) const
inline

Definition at line 196 of file C4GameControlNetwork.h.

196 { return tTime; }

References tTime.

Referenced by C4GameControlNetwork::CalcPerformance().

Here is the caller graph for this function:

◆ operator=()

C4GameControlPacket & C4GameControlPacket::operator= ( const C4GameControlPacket Pkt2)

Definition at line 864 of file C4GameControlNetwork.cpp.

865 {
866  Set(Pkt2.getClientID(), Pkt2.getCtrlTick(), Pkt2.getControl());
867  return *this;
868 }
void Set(int32_t iClientID, int32_t iCtrlTick)

References getClientID(), getControl(), getCtrlTick(), and Set().

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:

◆ Set() [1/2]

void C4GameControlPacket::Set ( int32_t  iClientID,
int32_t  iCtrlTick 
)

Definition at line 870 of file C4GameControlNetwork.cpp.

871 {
872  iClientID = inClientID;
873  iCtrlTick = inCtrlTick;
874 }

References iClientID, and iCtrlTick.

Referenced by C4GameControlNetwork::AddSyncCtrlToQueue(), C4GameControlNetwork::DoInput(), operator=(), and C4GameControlNetwork::PackCompleteCtrl().

Here is the caller graph for this function:

◆ Set() [2/2]

void C4GameControlPacket::Set ( int32_t  iClientID,
int32_t  iCtrlTick,
const C4Control Ctrl 
)

Definition at line 876 of file C4GameControlNetwork.cpp.

877 {
878  iClientID = inClientID;
879  iCtrlTick = inCtrlTick;
880  Ctrl.Copy(nCtrl);
881 }

References C4Control::Copy(), Ctrl, iClientID, and iCtrlTick.

Here is the call 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:

Friends And Related Function Documentation

◆ C4GameControlNetwork

friend class C4GameControlNetwork
friend

Definition at line 174 of file C4GameControlNetwork.h.

Member Data Documentation

◆ Ctrl

C4Control C4GameControlPacket::Ctrl
protected

Definition at line 188 of file C4GameControlNetwork.h.

Referenced by Add(), C4GameControlPacket(), CompileFunc(), getControl(), and Set().

◆ iClientID

int32_t C4GameControlPacket::iClientID
protected

Definition at line 184 of file C4GameControlNetwork.h.

Referenced by CompileFunc(), getClientID(), and Set().

◆ iCtrlTick

int32_t C4GameControlPacket::iCtrlTick {-1}
protected

Definition at line 184 of file C4GameControlNetwork.h.

Referenced by CompileFunc(), getCtrlTick(), and Set().

◆ pNext

◆ tTime

C4TimeMilliseconds C4GameControlPacket::tTime
protected

Definition at line 185 of file C4GameControlNetwork.h.

Referenced by getTime().


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