OpenTTD Source: NetworkClientInfo Struct Reference

OpenTTD Source 14.1

Public Member Functions | Static Public Member Functions | Data Fields
NetworkClientInfo Struct Reference

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

`#include <network_base.h>`

Inheritance diagram for NetworkClientInfo:

## Public Member Functions
| NetworkClientInfo (ClientID client_id=INVALID_CLIENT_ID)
| Create a new client. More...
| ~NetworkClientInfo ()
| Basically a client is leaving us right now.
Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientinfo_pool >
void * | operator new (size_t size)
| Allocates space for new Titem. More...
void * | operator new (size_t size, size_t index)
| Allocates space for new Titem with given index. More...
void * | operator new (size_t, void *ptr)
| Allocates space for new Titem at given memory address. More...
void | operator delete (void *p)
| Marks Titem as free. More...

## Static Public Member Functions
static NetworkClientInfo * | GetByClientID (ClientID client_id)
| Return the CI given it's client-identifier. More...
Static Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientinfo_pool >
static bool | CanAllocateItem (size_t n=1)
| Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() More...
static bool | CleaningPool ()
| Returns current state of pool cleaning - yes or no. More...
static bool | IsValidID (size_t index)
| Tests whether given index can be used to get valid (non-nullptr) Titem. More...
static Titem * | Get (size_t index)
| Returns Titem with given index. More...
static Titem * | GetIfValid (size_t index)
| Returns Titem with given index. More...
static size_t | GetPoolSize ()
| Returns first unused index. More...
static size_t | GetNumItems ()
| Returns number of valid items in the pool. More...
static void | PostDestructor ([[maybe_unused]] size_t index)
| Dummy function called after destructor of each member. More...
static Pool::IterateWrapper< Titem > | Iterate (size_t from=0)
| Returns an iterable ensemble of all valid Titem. More...

## Data Fields
ClientID | client_id
| Client identifier (same as ClientState->client_id)
std::string | client_name
| Name of the client.
CompanyID | client_playas
| As which company is this client playing (CompanyID)
TimerGameEconomy::Date | join_date
| Gamedate the client has joined.
Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientinfo_pool >
Tindex | index
| Index of this pool item.

## Additional Inherited Members
Public Types inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientinfo_pool >
typedef struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > | Pool
| Type of the pool this item is going to be part of.

## 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 | ( | ClientID | client_id = `INVALID_CLIENT_ID` | ) |
| inline

Create a new client.

Parameters

  client_id | The unique identifier of the client.

Definition at line 34 of file network_base.h.

## Member Function Documentation

## ◆ GetByClientID()

NetworkClientInfo * NetworkClientInfo::GetByClientID | ( | ClientID | client_id | ) |
| static

Return the CI given it's client-identifier.

Parameters

  client_id | the ClientID to search for

Returns
  return a pointer to the corresponding NetworkClientInfo struct or nullptr when not found

Definition at line 120 of file network.cpp.

References client_id, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientinfo_pool >::Iterate().

Referenced by CmdCompanyCtrl(), NetworkAutoCleanCompanies(), NetworkMakeClientNameUnique(), NetworkServerChangeClientName(), NetworkServerDoMove(), NetworkServerSendChat(), NetworkUpdateClientInfo(), NetworkUpdateClientName(), NetworkClientListWindow::RebuildList(), ClientNetworkGameSocketHandler::Receive_SERVER_CHAT(), ClientNetworkGameSocketHandler::Receive_SERVER_ERROR_QUIT(), ClientNetworkGameSocketHandler::Receive_SERVER_JOIN(), ClientNetworkGameSocketHandler::Receive_SERVER_QUIT(), and ServerNetworkGameSocketHandler::SendWelcome().

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

- src/network/network_base.h
- src/network/network.cpp