OpenTTD Source 20241224-master-gf74b0cf984
|
Container for all information known about a client. More...
#include <network_base.h>
Public Member Functions | |
NetworkClientInfo (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. | |
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. | |
void * | operator new (size_t size, size_t index) |
Allocates space for new Titem with given index. | |
void * | operator new (size_t, void *ptr) |
Allocates space for new Titem at given memory address. | |
void | operator delete (void *p) |
Marks Titem as free. | |
Static Public Member Functions | |
static NetworkClientInfo * | GetByClientID (ClientID client_id) |
Return the CI given it's client-identifier. | |
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() | |
static bool | CleaningPool () |
Returns current state of pool cleaning - yes or no. | |
static bool | IsValidID (size_t index) |
Tests whether given index can be used to get valid (non-nullptr) Titem. | |
static Titem * | Get (size_t index) |
Returns Titem with given index. | |
static Titem * | GetIfValid (size_t index) |
Returns Titem with given index. | |
static size_t | GetPoolSize () |
Returns first unused index. | |
static size_t | GetNumItems () |
Returns number of valid items in the pool. | |
static void | PostDestructor (size_t index) |
Dummy function called after destructor of each member. | |
static Pool::IterateWrapper< Titem > | Iterate (size_t from=0) |
Returns an iterable ensemble of all valid Titem. | |
Data Fields | |
ClientID | 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 |
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. | |
Container for all information known about a client.
Definition at line 24 of file network_base.h.
|
inline |
Create a new client.
client_id | The unique identifier of the client. |
Definition at line 35 of file network_base.h.
NetworkClientInfo::~NetworkClientInfo | ( | ) |
Basically a client is leaving us right now.
Definition at line 105 of file network.cpp.
References client_id, DESTTYPE_CLIENT, InvalidateWindowData(), and WC_SEND_NETWORK_MSG.
bool NetworkClientInfo::CanJoinCompany | ( | CompanyID | company_id | ) | const |
Returns whether the given company can be joined by this client.
company_id | The id of the company. |
true
when this company is allowed to join, otherwise false
. Definition at line 130 of file network.cpp.
References CompanyProperties::allow_list, NetworkAuthorizedKeys::Contains(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), and public_key.
Referenced by NetworkCanJoinCompany().
|
static |
Return the CI given it's client-identifier.
client_id | the ClientID to search for |
Definition at line 116 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(), CmdGoalQuestion(), NetworkClientListWindow::DrawWidget(), NetworkAutoCleanCompanies(), NetworkCanJoinCompany(), NetworkMakeClientNameUnique(), NetworkOnGameStart(), NetworkServerChangeClientName(), NetworkServerDoMove(), NetworkServerSendChat(), NetworkUpdateClientInfo(), NetworkUpdateClientName(), NetworkClientListWindow::OnClick(), NetworkClientListWindow::OnDropdownSelect(), MainWindow::OnHotkey(), NetworkClientListWindow::RebuildList(), ServerNetworkAdminSocketHandler::Receive_ADMIN_POLL(), ClientNetworkGameSocketHandler::Receive_SERVER_CHAT(), ClientNetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(), ClientNetworkGameSocketHandler::Receive_SERVER_ERROR_QUIT(), ClientNetworkGameSocketHandler::Receive_SERVER_JOIN(), ClientNetworkGameSocketHandler::Receive_SERVER_MOVE(), ClientNetworkGameSocketHandler::Receive_SERVER_QUIT(), ServerNetworkGameSocketHandler::SendWelcome(), NetworkChatWindow::SetStringParameters(), NetworkClientListWindow::SetStringParameters(), and NetworkClientListWindow::UpdateWidgetSize().
ClientID NetworkClientInfo::client_id |
Client identifier (same as ClientState->client_id)
Definition at line 25 of file network_base.h.
Referenced by CmdCompanyCtrl(), GetByClientID(), NetworkServerNewCompany(), NetworkServerSendChat(), ServerNetworkGameSocketHandler::Receive_CLIENT_CHAT(), ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(), ServerNetworkGameSocketHandler::Receive_CLIENT_SET_NAME(), ServerNetworkAdminSocketHandler::SendClientInfo(), ServerNetworkGameSocketHandler::SendClientInfo(), ServerNetworkAdminSocketHandler::SendClientUpdate(), and ~NetworkClientInfo().
std::string NetworkClientInfo::client_name |
Name of the client.
Definition at line 26 of file network_base.h.
Referenced by ServerNetworkGameSocketHandler::GetClientName(), NetworkMakeClientNameUnique(), NetworkServerChangeClientName(), NetworkServerNewCompany(), NetworkServerSendChat(), NetworkServerShowStatusToConsole(), NetworkUpdateClientName(), ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(), ServerNetworkGameSocketHandler::Receive_CLIENT_SET_NAME(), ClientNetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(), ClientNetworkGameSocketHandler::Receive_SERVER_ERROR_QUIT(), ClientNetworkGameSocketHandler::Receive_SERVER_JOIN(), ClientNetworkGameSocketHandler::Receive_SERVER_QUIT(), ServerNetworkAdminSocketHandler::SendClientInfo(), ServerNetworkGameSocketHandler::SendClientInfo(), and ServerNetworkAdminSocketHandler::SendClientUpdate().
CompanyID NetworkClientInfo::client_playas |
As which company is this client playing (CompanyID)
Definition at line 28 of file network_base.h.
Referenced by CmdCompanyCtrl(), NetworkAutoCleanCompanies(), NetworkClientPreferTeamChat(), NetworkOnGameStart(), NetworkServerDoMove(), NetworkServerNewCompany(), NetworkServerSendChat(), NetworkServerShowStatusToConsole(), NetworkUpdateClientInfo(), ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(), ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(), ClientNetworkGameSocketHandler::Receive_SERVER_CHAT(), ClientNetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(), ServerNetworkAdminSocketHandler::SendClientInfo(), ServerNetworkGameSocketHandler::SendClientInfo(), and ServerNetworkAdminSocketHandler::SendClientUpdate().
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(), ServerNetworkAdminSocketHandler::SendClientInfo(), and ServerNetworkGameSocketHandler::SendWait().
std::string NetworkClientInfo::public_key |
The public key of the client.
Definition at line 27 of file network_base.h.
Referenced by CanJoinCompany(), NetworkServerNewCompany(), ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(), ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(), ClientNetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(), and ServerNetworkGameSocketHandler::SendClientInfo().