OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4Network2Status Class Reference

#include <C4Network2.h>

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

Public Member Functions

 C4Network2Status ()
 
C4NetGameState getState () const
 
int32_t getCtrlMode () const
 
int32_t getTargetCtrlTick () const
 
const char * getStateName () const
 
const char * getDescription () const
 
bool isEnabled () const
 
bool isLobbyActive () const
 
bool isPastLobby () const
 
bool isPaused () const
 
bool isRunning () const
 
void Set (C4NetGameState eState, int32_t iTargetCtrlTick)
 
void SetCtrlMode (int32_t iCtrlMode)
 
void SetTargetTick (int32_t iTargetCtrlTick)
 
void Clear ()
 
void CompileFunc (StdCompiler *pComp, bool fReference)
 
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

C4NetGameState eState
 
int32_t iCtrlMode
 
int32_t iTargetCtrlTick
 

Detailed Description

Definition at line 69 of file C4Network2.h.

Constructor & Destructor Documentation

C4Network2Status::C4Network2Status ( )

Definition at line 56 of file C4Network2.cpp.

58 {
59 
60 }
int32_t iTargetCtrlTick
Definition: C4Network2.h:77
C4NetGameState eState
Definition: C4Network2.h:75

Member Function Documentation

void C4Network2Status::Clear ( )

Definition at line 103 of file C4Network2.cpp.

References eState, GS_None, and iTargetCtrlTick.

Referenced by C4Network2::Clear().

104 {
106 }
int32_t iTargetCtrlTick
Definition: C4Network2.h:77
C4NetGameState eState
Definition: C4Network2.h:75

Here is the caller graph for this function:

void C4Network2Status::CompileFunc ( StdCompiler pComp,
bool  fReference 
)

Definition at line 113 of file C4Network2.cpp.

References eState, GS_Go, GS_Init, GS_Lobby, GS_None, GS_Pause, iCtrlMode, iTargetCtrlTick, mkIntPackAdapt(), mkNamingAdapt(), and StdCompiler::Value().

Referenced by CompileFunc().

114 {
115  StdEnumEntry<C4NetGameState> GameStates[] =
116  {
117  { "None", GS_None },
118  { "Init", GS_Init },
119  { "Lobby", GS_Lobby },
120  { "Paused", GS_Pause },
121  { "Running", GS_Go },
122  };
123  pComp->Value(mkNamingAdapt(mkEnumAdaptT<uint8_t>(eState, GameStates), "State", GS_None));
124  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iCtrlMode), "CtrlMode", -1));
125 
126  if (!fReference)
127  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iTargetCtrlTick), "TargetTick", -1));
128 }
Definition: StdAdaptors.h:760
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
int32_t iCtrlMode
Definition: C4Network2.h:76
void Value(const T &rStruct)
Definition: StdCompiler.h:171
int32_t iTargetCtrlTick
Definition: C4Network2.h:77
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:757
C4NetGameState eState
Definition: C4Network2.h:75

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Network2Status::CompileFunc ( StdCompiler pComp)
virtual

Implements C4PacketBase.

Definition at line 108 of file C4Network2.cpp.

References CompileFunc().

109 {
110  CompileFunc(pComp, false);
111 }
void CompileFunc(StdCompiler *pComp, bool fReference)
Definition: C4Network2.cpp:113

Here is the call graph for this function:

int32_t C4Network2Status::getCtrlMode ( ) const
inline

Definition at line 81 of file C4Network2.h.

References iCtrlMode.

Referenced by C4Network2::DrawStatus(), C4Network2::OnStatusAck(), and C4Network2::SetCtrlMode().

81 { return iCtrlMode; }
int32_t iCtrlMode
Definition: C4Network2.h:76

Here is the caller graph for this function:

const char * C4Network2Status::getDescription ( ) const

Definition at line 75 of file C4Network2.cpp.

References eState, GS_Go, GS_Init, GS_Lobby, GS_None, GS_Pause, and LoadResStr().

Referenced by C4StartupNetListEntry::SetReference().

76 {
77  switch (eState)
78  {
79  case GS_None: return LoadResStr("IDS_DESC_NOTINITED");
80  case GS_Init: return LoadResStr("IDS_DESC_WAITFORHOST");
81  case GS_Lobby: return LoadResStr("IDS_DESC_EXPECTING");
82  case GS_Pause: return LoadResStr("IDS_DESC_GAMEPAUSED");
83  case GS_Go: return LoadResStr("IDS_DESC_GAMERUNNING");
84  }
85  return LoadResStr("IDS_DESC_UNKNOWNGAMESTATE");
86 }
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4NetGameState eState
Definition: C4Network2.h:75

Here is the call graph for this function:

Here is the caller graph for this function:

C4NetGameState C4Network2Status::getState ( ) const
inline
const char * C4Network2Status::getStateName ( ) const

Definition at line 62 of file C4Network2.cpp.

References eState, GS_Go, GS_Init, GS_Lobby, GS_None, and GS_Pause.

Referenced by C4Network2::ChangeGameStatus(), C4Network2::DrawStatus(), C4Network2::HandleJoinData(), C4Network2::HandleStatus(), and C4Network2::OnStatusAck().

63 {
64  switch (eState)
65  {
66  case GS_None: return "none";
67  case GS_Init: return "init";
68  case GS_Lobby: return "lobby";
69  case GS_Pause: return "pause";
70  case GS_Go: return "go";
71  }
72  return "???";
73 }
C4NetGameState eState
Definition: C4Network2.h:75

Here is the caller graph for this function:

int32_t C4Network2Status::getTargetCtrlTick ( ) const
inline

Definition at line 82 of file C4Network2.h.

References iTargetCtrlTick.

Referenced by C4Network2::CheckStatusReached(), C4Network2::DrawStatus(), C4Network2::HandleStatus(), C4Network2::HandleStatusAck(), and C4Network2::OnStatusAck().

82 { return iTargetCtrlTick; }
int32_t iTargetCtrlTick
Definition: C4Network2.h:77

Here is the caller graph for this function:

bool C4Network2Status::isEnabled ( ) const
inline

Definition at line 86 of file C4Network2.h.

References GS_None.

Referenced by C4Network2::isEnabled().

86 { return eState != GS_None; }
C4NetGameState eState
Definition: C4Network2.h:75

Here is the caller graph for this function:

bool C4Network2Status::isLobbyActive ( ) const
inline

Definition at line 87 of file C4Network2.h.

References GS_Lobby.

Referenced by C4Network2Reference::getSortOrder(), C4Network2::isLobbyActive(), and C4StartupNetListEntry::SetReference().

87 { return eState == GS_Lobby; }
C4NetGameState eState
Definition: C4Network2.h:75

Here is the caller graph for this function:

bool C4Network2Status::isPastLobby ( ) const
inline

Definition at line 88 of file C4Network2.h.

References GS_Lobby.

Referenced by C4Console::In(), C4Network2::isPastLobby(), C4TeamList::RecheckPlayerInfoTeams(), and C4StartupNetListEntry::SetReference().

88 { return eState > GS_Lobby; }
C4NetGameState eState
Definition: C4Network2.h:75

Here is the caller graph for this function:

bool C4Network2Status::isPaused ( ) const
inline

Definition at line 89 of file C4Network2.h.

References GS_Pause.

Referenced by C4Network2::isPaused(), and C4Network2::isPausing().

89 { return eState == GS_Pause; }
C4NetGameState eState
Definition: C4Network2.h:75

Here is the caller graph for this function:

bool C4Network2Status::isRunning ( ) const
inline

Definition at line 90 of file C4Network2.h.

References GS_Go.

Referenced by C4Network2::isRunning().

90 { return eState == GS_Go; }
C4NetGameState eState
Definition: C4Network2.h:75

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

Here is the call graph for this function:

void C4Network2Status::Set ( C4NetGameState  eState,
int32_t  iTargetCtrlTick 
)

Definition at line 88 of file C4Network2.cpp.

References eState, and iTargetCtrlTick.

Referenced by C4Network2::ChangeGameStatus(), and C4Network2::InitHost().

89 {
90  eState = enState; iTargetCtrlTick = inTargetTick;
91 }
int32_t iTargetCtrlTick
Definition: C4Network2.h:77
C4NetGameState eState
Definition: C4Network2.h:75

Here is the caller graph for this function:

void C4Network2Status::SetCtrlMode ( int32_t  iCtrlMode)

Definition at line 93 of file C4Network2.cpp.

References iCtrlMode.

Referenced by C4Network2::ChangeGameStatus(), and C4Network2::InitHost().

94 {
95  iCtrlMode = inCtrlMode;
96 }
int32_t iCtrlMode
Definition: C4Network2.h:76

Here is the caller graph for this function:

void C4Network2Status::SetTargetTick ( int32_t  iTargetCtrlTick)

Definition at line 98 of file C4Network2.cpp.

References iTargetCtrlTick.

Referenced by C4Network2::CheckStatusReached(), and C4Network2::UpdateChaseTarget().

99 {
100  iTargetCtrlTick = inTargetCtrlTick;
101 }
int32_t iTargetCtrlTick
Definition: C4Network2.h:77

Here is the caller graph for this function:

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

C4NetGameState C4Network2Status::eState
protected

Definition at line 75 of file C4Network2.h.

Referenced by Clear(), CompileFunc(), getDescription(), getState(), getStateName(), and Set().

int32_t C4Network2Status::iCtrlMode
protected

Definition at line 76 of file C4Network2.h.

Referenced by CompileFunc(), getCtrlMode(), and SetCtrlMode().

int32_t C4Network2Status::iTargetCtrlTick
protected

Definition at line 77 of file C4Network2.h.

Referenced by Clear(), CompileFunc(), getTargetCtrlTick(), Set(), and SetTargetTick().


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