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 }
C4TimeMilliseconds tTime
const int32_t C4ClientIDUnknown
Definition: C4Client.h:24
static C4TimeMilliseconds Now()

◆ C4GameControlPacket() [2/2]

C4GameControlPacket::C4GameControlPacket ( const C4GameControlPacket Pkt2)

Definition at line 856 of file C4GameControlNetwork.cpp.

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

857  : C4PacketBase(Pkt2), iClientID(Pkt2.getClientID()),
858  iCtrlTick(Pkt2.getCtrlTick()),
860 {
861  Ctrl.Copy(Pkt2.getControl());
862 }
C4TimeMilliseconds tTime
void Copy(const C4Control &Ctrl)
Definition: C4Control.h:86
const C4Control & getControl() const
int32_t getClientID() const
int32_t getCtrlTick() const
static C4TimeMilliseconds Now()
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.

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

Referenced by C4GameControlNetwork::PackCompleteCtrl().

884 {
885  Ctrl.Append(Ctrl2.getControl());
886 }
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.

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

889 {
891  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iCtrlTick), "CtrlTick", -1));
892  pComp->Value(mkNamingAdapt(Ctrl, "Ctrl"));
893 }
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
void Value(const T &rStruct)
Definition: StdCompiler.h:161
const int32_t C4ClientIDUnknown
Definition: C4Client.h:24
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:777
Here is the call graph for this function:

◆ getClientID()

int32_t C4GameControlPacket::getClientID ( ) const
inline

Definition at line 194 of file C4GameControlNetwork.h.

References C4GameControlNetwork::iClientID.

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

194 { return iClientID; }
Here is the caller graph for this function:

◆ getControl()

const C4Control& C4GameControlPacket::getControl ( ) const
inline

Definition at line 197 of file C4GameControlNetwork.h.

References CompileFunc().

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

197 { return Ctrl; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCtrlTick()

int32_t C4GameControlPacket::getCtrlTick ( ) const
inline

Definition at line 195 of file C4GameControlNetwork.h.

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

195 { return iCtrlTick; }
Here is the caller graph for this function:

◆ getTime()

C4TimeMilliseconds C4GameControlPacket::getTime ( ) const
inline

Definition at line 196 of file C4GameControlNetwork.h.

Referenced by C4GameControlNetwork::CalcPerformance().

196 { return tTime; }
C4TimeMilliseconds tTime
Here is the caller graph for this function:

◆ operator=()

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

Definition at line 864 of file C4GameControlNetwork.cpp.

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

865 {
866  Set(Pkt2.getClientID(), Pkt2.getCtrlTick(), Pkt2.getControl());
867  return *this;
868 }
void Set(int32_t iClientID, int32_t iCtrlTick)
const C4Control & getControl() const
int32_t getClientID() const
int32_t getCtrlTick() const
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.

Referenced by MkC4NetIOPacket().

151 {
152  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(*this), addr);
153 }
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.

References mkDecompileAdapt(), and mkInsertAdapt().

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

References iClientID, and iCtrlTick.

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

871 {
872  iClientID = inClientID;
873  iCtrlTick = inCtrlTick;
874 }
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.

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

877 {
878  iClientID = inClientID;
879  iCtrlTick = inCtrlTick;
880  Ctrl.Copy(nCtrl);
881 }
void Copy(const C4Control &Ctrl)
Definition: C4Control.h:86
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.

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

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

161 {
162  if (pStatus) *pStatus = Pkt.getStatus();
163  CompileFromBuf<StdCompilerBinRead>(*this, pStatus ? Pkt.getPBuf() : Pkt.getRef());
164 }
uint8_t getStatus() const
Definition: C4NetIO.h:318
StdBuf getPBuf() const
Definition: C4NetIO.h:321
C4NetIOPacket getRef() const
Definition: C4NetIO.h:324
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(), and Set().

◆ iClientID

int32_t C4GameControlPacket::iClientID
protected

Definition at line 184 of file C4GameControlNetwork.h.

Referenced by CompileFunc(), and Set().

◆ iCtrlTick

int32_t C4GameControlPacket::iCtrlTick {-1}
protected

Definition at line 184 of file C4GameControlNetwork.h.

Referenced by CompileFunc(), and Set().

◆ pNext

◆ tTime

C4TimeMilliseconds C4GameControlPacket::tTime
protected

Definition at line 185 of file C4GameControlNetwork.h.


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