OpenClonk
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() [1/2]

C4Client::C4Client ( )
default

◆ C4Client() [2/2]

C4Client::C4Client ( const C4ClientCore Core)

Definition at line 108 of file C4Client.cpp.

109  : Core(Core), pNext(nullptr)
110 {
111 
112 }

◆ ~C4Client()

C4Client::~C4Client ( )

Definition at line 114 of file C4Client.cpp.

115 {
116  // network client bind must be removed before
117  assert(!pNetClient);
118 }

Member Function Documentation

◆ CompileFunc()

void C4Client::CompileFunc ( StdCompiler pComp)

Definition at line 153 of file C4Client.cpp.

154 {
155  pComp->Value(Core);
156  // Assume this is a non-local client
157  if (pComp->isDeserializer())
158  fLocal = false;
159 }
void Value(const T &rStruct)
Definition: StdCompiler.h:161
virtual bool isDeserializer()
Definition: StdCompiler.h:53

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

Here is the call graph for this function:

◆ getCore()

const C4ClientCore& C4Client::getCore ( ) const
inline

Definition at line 104 of file C4Client.h.

104 { return Core; }

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

Here is the caller graph for this function:

◆ getCUID()

const char* C4Client::getCUID ( ) const
inline

Definition at line 108 of file C4Client.h.

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

References C4ClientCore::getCUID().

Referenced by C4StartupNetListEntry::IsSameHost().

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

◆ getID()

int32_t C4Client::getID ( ) const
inline

Definition at line 105 of file C4Client.h.

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

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().

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

◆ getName()

const char* C4Client::getName ( ) const
inline

Definition at line 107 of file C4Client.h.

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

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().

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

◆ getNetClient()

C4Network2Client* C4Client::getNetClient ( ) const
inline

Definition at line 117 of file C4Client.h.

117 { return pNetClient; }

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

Here is the caller graph for this function:

◆ getNick()

const char* C4Client::getNick ( ) const
inline

Definition at line 109 of file C4Client.h.

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

References C4ClientCore::getNick().

Here is the call graph for this function:

◆ isActivated()

bool C4Client::isActivated ( ) const
inline

Definition at line 110 of file C4Client.h.

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

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().

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

◆ isHost()

bool C4Client::isHost ( ) const
inline

Definition at line 106 of file C4Client.h.

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

References C4ClientCore::isHost().

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

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

◆ IsIgnored()

bool C4Client::IsIgnored ( ) const
inline

Definition at line 114 of file C4Client.h.

114 { return fIsIgnored; }

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

Here is the caller graph for this function:

◆ isLobbyReady()

bool C4Client::isLobbyReady ( ) const
inline

Definition at line 112 of file C4Client.h.

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

References C4ClientCore::isLobbyReady().

Here is the call graph for this function:

◆ isLocal()

bool C4Client::isLocal ( ) const
inline

Definition at line 116 of file C4Client.h.

116 { return fLocal; }

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

Here is the caller graph for this function:

◆ isObserver()

bool C4Client::isObserver ( ) const
inline

Definition at line 111 of file C4Client.h.

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

References C4ClientCore::isObserver().

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

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

◆ isRegistered()

bool C4Client::isRegistered ( ) const
inline

Definition at line 113 of file C4Client.h.

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

References C4ClientCore::isRegistered().

Here is the call graph for this function:

◆ Remove()

void C4Client::Remove ( )

Definition at line 147 of file C4Client.cpp.

148 {
149  // remove players for this client
150  ::Players.RemoveAtClient(getID(), true);
151 }
C4PlayerList Players
int32_t getID() const
Definition: C4Client.h:105
bool RemoveAtClient(int iClient, bool fDisconnect)

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

Referenced by C4ClientList::Remove().

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

◆ SetActivated()

void C4Client::SetActivated ( bool  fnActivated)

Definition at line 120 of file C4Client.cpp.

121 {
122  Core.SetActivated(fnActivated);
123  // activity
124  if (fnActivated && pNetClient)
125  pNetClient->SetLastActivity(Game.FrameCounter);
126 }
C4Game Game
Definition: C4Globals.cpp:52
void SetActivated(bool fnActivated)
Definition: C4Client.h:64
int32_t FrameCounter
Definition: C4Game.h:129
void SetLastActivity(int32_t iTick)

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

Referenced by C4GameControl::ChangeToLocal().

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

◆ SetCore()

void C4Client::SetCore ( const C4ClientCore NewCore)
inline

Definition at line 119 of file C4Client.h.

119 { Core = NewCore; }

Referenced by C4ClientList::operator=().

Here is the caller graph for this function:

◆ SetID()

void C4Client::SetID ( int32_t  iID)
inline

Definition at line 120 of file C4Client.h.

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

References C4ClientCore::SetID().

Referenced by C4ClientList::SetLocalID().

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

◆ SetLobbyReady()

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

Definition at line 128 of file C4Client.cpp.

129 {
130  // Change state
131  Core.SetLobbyReady(fnLobbyReady);
132  // Keep track of times
133  if (time_since_last_change)
134  {
135  time_t now = time(nullptr);
136  *time_since_last_change = now - last_lobby_ready_change;
137  last_lobby_ready_change = now;
138  }
139 }
void SetLobbyReady(bool fnLobbyReady)
Definition: C4Client.h:66

References C4ClientCore::SetLobbyReady().

Here is the call graph for this function:

◆ SetLocal()

void C4Client::SetLocal ( )

Definition at line 141 of file C4Client.cpp.

142 {
143  // set flag
144  fLocal = true;
145 }

Referenced by C4ClientList::AddLocal().

Here is the caller graph for this function:

◆ SetObserver()

void C4Client::SetObserver ( )
inline

Definition at line 123 of file C4Client.h.

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

References C4ClientCore::SetObserver().

Here is the call graph for this function:

◆ ToggleIgnore()

void C4Client::ToggleIgnore ( )
inline

Definition at line 127 of file C4Client.h.

127 { fIsIgnored = !fIsIgnored; }

◆ UnlinkNetClient()

void C4Client::UnlinkNetClient ( )
inline

Definition at line 129 of file C4Client.h.

129 { pNetClient = nullptr; }

Referenced by C4Network2Client::~C4Network2Client().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ C4ClientList

friend class C4ClientList
friend

Definition at line 86 of file C4Client.h.


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