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

#include <C4Client.h>

Public Member Functions

 C4Client ()
 
 C4Client (const C4ClientCore &Core)
 
 ~C4Client ()
 
const C4ClientCoregetCore () const
 
int32_t getID () const
 
bool isHost () const
 
const char * getName () const
 
const char * getCUID () const
 
const char * getNick () const
 
bool isActivated () const
 
bool isObserver () const
 
bool isLobbyReady () const
 
bool isRegistered () const
 
bool IsIgnored () const
 
bool isLocal () const
 
C4Network2ClientgetNetClient () const
 
void SetCore (const C4ClientCore &NewCore)
 
void SetID (int32_t iID)
 
void SetActivated (bool fnActivated)
 
void SetObserver ()
 
void SetLobbyReady (bool fnLobbyReady, time_t *time_since_last_change=nullptr)
 
void SetLocal ()
 
void ToggleIgnore ()
 
void UnlinkNetClient ()
 
void Remove ()
 
void CompileFunc (StdCompiler *pComp)
 

Friends

class C4ClientList
 

Detailed Description

Definition at line 84 of file C4Client.h.

Constructor & Destructor Documentation

C4Client::C4Client ( )

Definition at line 116 of file C4Client.cpp.

117  : fLocal(false), pNetClient(nullptr), fIsIgnored(false), last_lobby_ready_change(0)
118 {
119 }
C4Client::C4Client ( const C4ClientCore Core)

Definition at line 121 of file C4Client.cpp.

122  : Core(Core), fLocal(false), pNetClient(nullptr), fIsIgnored(false), pNext(nullptr), last_lobby_ready_change(0)
123 {
124 
125 }
C4Client::~C4Client ( )

Definition at line 127 of file C4Client.cpp.

128 {
129  // network client bind must be removed before
130  assert(!pNetClient);
131 }

Member Function Documentation

void C4Client::CompileFunc ( StdCompiler pComp)

Definition at line 166 of file C4Client.cpp.

References StdCompiler::isDeserializer(), and StdCompiler::Value().

167 {
168  pComp->Value(Core);
169  // Assume this is a non-local client
170  if (pComp->isDeserializer())
171  fLocal = false;
172 }
void Value(const T &rStruct)
Definition: StdCompiler.h:171
virtual bool isDeserializer()
Definition: StdCompiler.h:63

Here is the call graph for this function:

const C4ClientCore& C4Client::getCore ( ) const
inline

Definition at line 104 of file C4Client.h.

Referenced by C4Network2Client::DoConnectAttempt(), C4Network2Client::getCore(), C4ClientList::getLocalCore(), C4Network2::HandleJoinData(), C4ClientList::operator=(), and C4Network2ClientList::RegClient().

104 { return Core; }

Here is the caller graph for this function:

const char* C4Client::getCUID ( ) const
inline

Definition at line 108 of file C4Client.h.

References C4ClientCore::getCUID().

Referenced by C4StartupNetListEntry::IsSameHost().

108 { return Core.getCUID(); }
const char * getCUID() const
Definition: C4Client.h:70

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4Client::getID ( ) const
inline

Definition at line 105 of file C4Client.h.

References C4ClientCore::getID().

Referenced by C4ClientList::Add(), C4GameControlNetwork::CopyClientList(), C4ClientList::CtrlRemove(), C4GameControl::InitLocal(), C4GameControl::InitNetwork(), C4Network2Players::OnClientPart(), C4GameLobby::MainDlg::OnClientSound(), C4GameLobby::MainDlg::OnMessage(), C4Network2ClientListDlg::OnSound(), C4ClientList::operator=(), C4MessageInput::ProcessCommand(), C4Network2ClientList::RegClient(), Remove(), and C4Network2ClientListBox::Update().

105 { return Core.getID(); }
int32_t getID() const
Definition: C4Client.h:57

Here is the call graph for this function:

Here is the caller graph for this function:

const char* C4Client::getName ( ) const
inline

Definition at line 107 of file C4Client.h.

References C4ClientCore::getName().

Referenced by C4GameControlNetwork::CopyClientList(), C4ControlVote::getDesc(), C4Game::InitNetworkFromReference(), C4StartupNetListEntry::IsSameHost(), C4StartupNetListEntry::KeywordMatch(), C4Network2::OpenVoteDialog(), C4PlayerInfoList::RecreatePlayers(), C4PlayerInfoList::SetAsRestoreInfos(), C4StartupNetListEntry::SetReference(), and C4Network2ClientDlg::UpdateText().

107 { return Core.getName(); }
const char * getName() const
Definition: C4Client.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

C4Network2Client* C4Client::getNetClient ( ) const
inline

Definition at line 117 of file C4Client.h.

Referenced by C4ClientList::CtrlRemove(), C4Network2Reference::InitLocal(), C4Network2ClientList::RegClient(), C4ClientList::Remove(), C4Network2ClientListBox::Update(), and C4Network2ClientDlg::UpdateText().

117 { return pNetClient; }

Here is the caller graph for this function:

const char* C4Client::getNick ( ) const
inline

Definition at line 109 of file C4Client.h.

References C4ClientCore::getNick().

109 { return Core.getNick(); }
const char * getNick() const
Definition: C4Client.h:71

Here is the call graph for this function:

bool C4Client::isActivated ( ) const
inline

Definition at line 110 of file C4Client.h.

References C4ClientCore::isActivated().

Referenced by C4GameControlNetwork::CopyClientList(), C4GameControlNetwork::DecideControlDelivery(), C4Network2Players::GetClientChatColor(), C4Network2::HandleJoinData(), C4Network2Players::HandlePlayerInfo(), C4Network2Players::JoinLocalPlayer(), C4Network2Players::OnStatusGoReached(), C4GameControl::Prepare(), C4Network2::RequestActivate(), and C4Network2ClientDlg::UpdateText().

110 { return Core.isActivated(); }
bool isActivated() const
Definition: C4Client.h:59

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Client::isHost ( ) const
inline

Definition at line 106 of file C4Client.h.

References C4ClientCore::isHost().

Referenced by C4ClientList::CtrlRemove(), C4GameControl::InitNetwork(), C4Network2ClientListBox::Update(), and C4Network2ClientDlg::UpdateText().

106 { return Core.isHost(); }
bool isHost() const
Definition: C4Client.h:58

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Client::IsIgnored ( ) const
inline

Definition at line 114 of file C4Client.h.

Referenced by C4GameLobby::MainDlg::OnMessage().

114 { return fIsIgnored; }

Here is the caller graph for this function:

bool C4Client::isLobbyReady ( ) const
inline

Definition at line 112 of file C4Client.h.

References C4ClientCore::isLobbyReady().

112 { return Core.isLobbyReady(); }
bool isLobbyReady() const
Definition: C4Client.h:61

Here is the call graph for this function:

bool C4Client::isLocal ( ) const
inline

Definition at line 116 of file C4Client.h.

Referenced by C4ClientList::Add(), C4Network2Client::isLocal(), C4Network2ClientList::RegClient(), and C4Network2ClientDlg::UpdateText().

116 { return fLocal; }

Here is the caller graph for this function:

bool C4Client::isObserver ( ) const
inline

Definition at line 111 of file C4Client.h.

References C4ClientCore::isObserver().

Referenced by C4Network2Players::JoinLocalPlayer(), and C4Network2::RequestActivate().

111 { return Core.isObserver(); }
bool isObserver() const
Definition: C4Client.h:60

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Client::isRegistered ( ) const
inline

Definition at line 113 of file C4Client.h.

References C4ClientCore::isRegistered().

113 { return Core.isRegistered(); }
bool isRegistered() const
Definition: C4Client.h:73

Here is the call graph for this function:

void C4Client::Remove ( )

Definition at line 160 of file C4Client.cpp.

References getID(), Players, and C4PlayerList::RemoveAtClient().

Referenced by C4ClientList::Remove().

161 {
162  // remove players for this client
163  ::Players.RemoveAtClient(getID(), true);
164 }
int32_t getID() const
Definition: C4Client.h:105
bool RemoveAtClient(int iClient, bool fDisconnect)
C4PlayerList Players

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Client::SetActivated ( bool  fnActivated)

Definition at line 133 of file C4Client.cpp.

References C4Game::FrameCounter, Game, C4ClientCore::SetActivated(), and C4Network2Client::SetLastActivity().

Referenced by C4GameControl::ChangeToLocal().

134 {
135  Core.SetActivated(fnActivated);
136  // activity
137  if (fnActivated && pNetClient)
138  pNetClient->SetLastActivity(Game.FrameCounter);
139 }
C4Game Game
Definition: C4Globals.cpp:52
void SetLastActivity(int32_t iTick)
int32_t FrameCounter
Definition: C4Game.h:130
void SetActivated(bool fnActivated)
Definition: C4Client.h:64

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Client::SetCore ( const C4ClientCore NewCore)
inline

Definition at line 119 of file C4Client.h.

Referenced by C4ClientList::operator=().

119 { Core = NewCore; }

Here is the caller graph for this function:

void C4Client::SetID ( int32_t  iID)
inline

Definition at line 120 of file C4Client.h.

References C4ClientCore::SetID().

Referenced by C4ClientList::SetLocalID().

120 { Core.SetID(iID); }
void SetID(int32_t inID)
Definition: C4Client.h:62

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Client::SetLobbyReady ( bool  fnLobbyReady,
time_t *  time_since_last_change = nullptr 
)

Definition at line 141 of file C4Client.cpp.

References C4ClientCore::SetLobbyReady().

142 {
143  // Change state
144  Core.SetLobbyReady(fnLobbyReady);
145  // Keep track of times
146  if (time_since_last_change)
147  {
148  time_t now = time(nullptr);
149  *time_since_last_change = now - last_lobby_ready_change;
150  last_lobby_ready_change = now;
151  }
152 }
void SetLobbyReady(bool fnLobbyReady)
Definition: C4Client.h:66

Here is the call graph for this function:

void C4Client::SetLocal ( )

Definition at line 154 of file C4Client.cpp.

Referenced by C4ClientList::AddLocal().

155 {
156  // set flag
157  fLocal = true;
158 }

Here is the caller graph for this function:

void C4Client::SetObserver ( )
inline

Definition at line 123 of file C4Client.h.

References C4ClientCore::SetObserver().

123 { Core.SetObserver(true); }
void SetObserver(bool fnObserver)
Definition: C4Client.h:65

Here is the call graph for this function:

void C4Client::ToggleIgnore ( )
inline

Definition at line 127 of file C4Client.h.

127 { fIsIgnored = !fIsIgnored; }
void C4Client::UnlinkNetClient ( )
inline

Definition at line 129 of file C4Client.h.

Referenced by C4Network2Client::~C4Network2Client().

129 { pNetClient = nullptr; }

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class C4ClientList
friend

Definition at line 86 of file C4Client.h.


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