OpenTTD Source 20260206-master-g4d4e37dbf1
NetworkClientInfo Struct Reference

Container for all information known about a client. More...

#include <network_base.h>

Inheritance diagram for NetworkClientInfo:

Public Member Functions

 NetworkClientInfo (ClientPoolID index, ClientID client_id=INVALID_CLIENT_ID)
 Create a new client.
 ~NetworkClientInfo ()
 Basically a client is leaving us right now.
bool CanJoinCompany (CompanyID company_id) const
 Returns whether the given company can be joined by this client.

Static Public Member Functions

static NetworkClientInfoGetByClientID (ClientID client_id)
 Return the CI given it's client-identifier.

Data Fields

ClientID client_id = INVALID_CLIENT_ID
 Client identifier (same as ClientState->client_id).
std::string client_name {}
 Name of the client.
std::string public_key {}
 The public key of the client.
CompanyID client_playas = CompanyID::Invalid()
 As which company is this client playing (CompanyID).
TimerGameEconomy::Date join_date {}
 Gamedate the client has joined.

Detailed Description

Container for all information known about a client.

Definition at line 24 of file network_base.h.

Constructor & Destructor Documentation

◆ NetworkClientInfo()

NetworkClientInfo::NetworkClientInfo ( ClientPoolID index,
ClientID client_id = INVALID_CLIENT_ID )
inline

Create a new client.

Parameters
indexThe index into the client info pool.
client_idThe unique identifier of the client.

Definition at line 36 of file network_base.h.

References client_id, and INVALID_CLIENT_ID.

Referenced by GetByClientID().

◆ ~NetworkClientInfo()

NetworkClientInfo::~NetworkClientInfo ( )

Basically a client is leaving us right now.

Definition at line 106 of file network.cpp.

References client_id, DESTTYPE_CLIENT, InvalidateWindowData(), and WC_SEND_NETWORK_MSG.

Member Function Documentation

◆ CanJoinCompany()

bool NetworkClientInfo::CanJoinCompany ( CompanyID company_id) const

Returns whether the given company can be joined by this client.

Parameters
company_idThe id of the company.
Returns
true when this company is allowed to join, otherwise false.

Definition at line 131 of file network.cpp.

References CompanyProperties::allow_list, NetworkAuthorizedKeys::Contains(), and public_key.

Referenced by NetworkCanJoinCompany().

◆ GetByClientID()

Field Documentation

◆ client_id

◆ client_name

◆ client_playas

◆ join_date

TimerGameEconomy::Date NetworkClientInfo::join_date {}

Gamedate the client has joined.

Definition at line 29 of file network_base.h.

Referenced by ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(), and ServerNetworkAdminSocketHandler::SendClientInfo().

◆ public_key


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