OpenTTD Source: ClientNetworkGameSocketHandler Class Reference

OpenTTD Source 15.0-beta1

Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | Private Types | Private Attributes | Friends
ClientNetworkGameSocketHandler Class Reference

Class for handling the client side of the game connection. More...

`#include <network_client.h>`

Inheritance diagram for ClientNetworkGameSocketHandler:

## Public Member Functions
| ClientNetworkGameSocketHandler (SOCKET s, const std::string &connection_string)
| Create a new socket for the client side of the game connection.
| ~ClientNetworkGameSocketHandler ()
| Clear whatever we assigned.
NetworkRecvStatus | CloseConnection (NetworkRecvStatus status) override
| Close the network connection due to the given status.
void | ClientError (NetworkRecvStatus res)
| Handle an error coming from the client side.
Public Member Functions inherited from ZeroedMemoryAllocator
void * | operator new (size_t size)
| Memory allocator for a single class instance.
void * | operator new[] (size_t size)
| Memory allocator for an array of class instances.
void | operator delete (void *ptr)
| Memory release for a single class instance.
void | operator delete[] (void *ptr)
| Memory release for an array of class instances.
Public Member Functions inherited from NetworkGameSocketHandler
NetworkRecvStatus | CloseConnection (bool error=true) override
| Functions to help ReceivePacket/SendPacket a bit A socket can make errors.
void | SetInfo (NetworkClientInfo *info)
| Sets the client info for this socket handler.
NetworkClientInfo * | GetInfo () const
| Gets the client info of this socket handler.
NetworkRecvStatus | ReceivePackets ()
| Do the actual receiving of packets.
const char * | ReceiveCommand (Packet &p, CommandPacket &cp)
| Receives a command from the network.
void | SendCommand (Packet &p, const CommandPacket &cp)
| Sends a command over the network.
bool | IsPendingDeletion () const
void | DeferDeletion ()
Public Member Functions inherited from NetworkTCPSocketHandler
bool | IsConnected () const
| Whether this socket is currently bound to a socket.
void | CloseSocket ()
| Close the actual socket of the connection.
virtual void | SendPacket (std::unique_ptr< Packet > &&packet)
| This function puts the packet in the send-queue and it is send as soon as possible.
SendPacketsState | SendPackets (bool closing_down=false)
| Sends all the buffered packets out for this client.
virtual std::unique_ptr< Packet > | ReceivePacket ()
| Receives a packet for the given client.
bool | CanSendReceive ()
| Check whether this socket can send or receive something.
bool | HasSendQueue ()
| Whether there is something pending in the send queue.
| NetworkTCPSocketHandler (SOCKET s=INVALID_SOCKET)
| Construct a socket handler for a TCP connection.
Public Member Functions inherited from NetworkSocketHandler
| NetworkSocketHandler ()
| Create a new unbound socket.
virtual | ~NetworkSocketHandler ()=default
| Close the socket when destructing the socket handler.
void | MarkClosed ()
| Mark the connection as closed.
bool | HasClientQuit () const
| Whether the current client connected to the socket has quit.
void | Reopen ()
| Reopen the socket so we can send/receive stuff again.

## Static Public Member Functions
static NetworkRecvStatus | SendJoin ()
| Tell the server we would like to join.
static NetworkRecvStatus | SendCommand (const CommandPacket &cp)
| Send a command to the server.
static NetworkRecvStatus | SendError (NetworkErrorCode errorno)
| Send an error-packet over the network.
static NetworkRecvStatus | SendQuit ()
| Tell the server we would like to quit.
static NetworkRecvStatus | SendAck ()
| Send an acknowledgement from the server's ticks.
static NetworkRecvStatus | SendAuthResponse ()
| Set the game password as requested.
static NetworkRecvStatus | SendChat (NetworkAction action, DestType type, int dest, const std::string &msg, int64_t data)
| Send a chat-packet over the network.
static NetworkRecvStatus | SendSetName (const std::string &name)
| Tell the server that we like to change the name of the client.
static NetworkRecvStatus | SendRCon (const std::string &password, const std::string &command)
| Send a console command.
static NetworkRecvStatus | SendMove (CompanyID company)
| Ask the server to move us.
static bool | IsConnected ()
| Check whether the client is actually connected (and in the game).
static void | Send ()
| Send the packets of this socket handler.
static bool | Receive ()
| Check whether we received/can send some data from/to the server and when that's the case handle it appropriately.
static bool | GameLoop ()
| Actual game loop for the client.
Static Public Member Functions inherited from NetworkGameSocketHandler
static void | ProcessDeferredDeletions ()

## Protected Member Functions
NetworkRecvStatus | Receive_SERVER_FULL (Packet &p) override
| Notification that the server is full.
NetworkRecvStatus | Receive_SERVER_BANNED (Packet &p) override
| Notification that the client trying to join is banned.
NetworkRecvStatus | Receive_SERVER_ERROR (Packet &p) override
| The client made an error: uint8_t Error code caused (see NetworkErrorCode).
NetworkRecvStatus | Receive_SERVER_CLIENT_INFO (Packet &p) override
| Send information about a client: uint32_t ID of the client (always unique on a server.
NetworkRecvStatus | Receive_SERVER_AUTH_REQUEST (Packet &p) override
| Indication to the client that it needs to authenticate: uint8_t The `NetworkAuthenticationMethod` to use.
NetworkRecvStatus | Receive_SERVER_ENABLE_ENCRYPTION (Packet &p) override
| Indication to the client that authentication is complete and encryption has to be used from here on forward.
NetworkRecvStatus | Receive_SERVER_WELCOME (Packet &p) override
| The client is joined and ready to receive their map: uint32_t Own client ID.
NetworkRecvStatus | Receive_SERVER_WAIT (Packet &p) override
| Notification that another client is currently receiving the map: uint8_t Number of clients waiting in front of you.
NetworkRecvStatus | Receive_SERVER_MAP_BEGIN (Packet &p) override
| Sends that the server will begin with sending the map to the client: uint32_t Current frame.
NetworkRecvStatus | Receive_SERVER_MAP_SIZE (Packet &p) override
| Sends the size of the map to the client.
NetworkRecvStatus | Receive_SERVER_MAP_DATA (Packet &p) override
| Sends the data of the map to the client: Contains a part of the map (until max size of packet).
NetworkRecvStatus | Receive_SERVER_MAP_DONE (Packet &p) override
| Sends that all data of the map are sent to the client:
NetworkRecvStatus | Receive_SERVER_JOIN (Packet &p) override
| A client joined (PACKET_CLIENT_MAP_OK), what usually directly follows is a PACKET_SERVER_CLIENT_INFO: uint32_t ID of the client that just joined the game.
NetworkRecvStatus | Receive_SERVER_FRAME (Packet &p) override
| Sends the current frame counter to the client: uint32_t Frame counter uint32_t Frame counter max (how far may the client walk before the server?) uint32_t General seed 1 (dependent on compile settings, not default).
NetworkRecvStatus | Receive_SERVER_SYNC (Packet &p) override
| Sends a sync-check to the client: uint32_t Frame counter.
NetworkRecvStatus | Receive_SERVER_COMMAND (Packet &p) override
| Sends a DoCommand to the client: uint8_t ID of the company (0..MAX_COMPANIES-1).
NetworkRecvStatus | Receive_SERVER_CHAT (Packet &p) override
| Sends a chat-packet to the client: uint8_t ID of the action (see NetworkAction).
NetworkRecvStatus | Receive_SERVER_EXTERNAL_CHAT (Packet &p) override
| Sends a chat-packet for external source to the client: string Name of the source this message came from.
NetworkRecvStatus | Receive_SERVER_QUIT (Packet &p) override
| Notification that a client left the game: uint32_t ID of the client.
NetworkRecvStatus | Receive_SERVER_ERROR_QUIT (Packet &p) override
| Inform all clients that one client made an error and thus has quit/been disconnected: uint32_t ID of the client that caused the error.
NetworkRecvStatus | Receive_SERVER_SHUTDOWN (Packet &p) override
| Let the clients know that the server is closing.
NetworkRecvStatus | Receive_SERVER_NEWGAME (Packet &p) override
| Let the clients know that the server is loading a new map.
NetworkRecvStatus | Receive_SERVER_RCON (Packet &p) override
| Send the result of an issues RCon command back to the client: uint16_t Colour code.
NetworkRecvStatus | Receive_SERVER_CHECK_NEWGRFS (Packet &p) override
| Sends information about all used GRFs to the client: uint8_t Amount of GRFs (the following data is repeated this many times, i.e.
NetworkRecvStatus | Receive_SERVER_MOVE (Packet &p) override
| Move a client from one company into another: uint32_t ID of the client.
NetworkRecvStatus | Receive_SERVER_CONFIG_UPDATE (Packet &p) override
| Update the clients knowledge of the max settings: uint8_t Maximum number of companies allowed.
void | CheckConnection ()
| Check the connection's state, i.e.
Protected Member Functions inherited from NetworkGameSocketHandler
NetworkRecvStatus | ReceiveInvalidPacket (PacketGameType type)
| Helper for logging receiving invalid packets.
virtual NetworkRecvStatus | Receive_CLIENT_JOIN (Packet &p)
| Try to join the server: string OpenTTD revision (norev0000 if no revision).
virtual NetworkRecvStatus | Receive_CLIENT_GAME_INFO (Packet &p)
| Request game information.
virtual NetworkRecvStatus | Receive_SERVER_GAME_INFO (Packet &p)
| Sends information about the game.
virtual NetworkRecvStatus | Receive_CLIENT_IDENTIFY (Packet &p)
| The client tells the server about the identity of the client: string Name of the client (max NETWORK_NAME_LENGTH).
virtual NetworkRecvStatus | Receive_CLIENT_AUTH_RESPONSE (Packet &p)
| Send the response to the authentication request: 32 * uint8_t Public key of the client.
virtual NetworkRecvStatus | Receive_CLIENT_GETMAP (Packet &p)
| Request the map from the server.
virtual NetworkRecvStatus | Receive_CLIENT_MAP_OK (Packet &p)
| Tell the server that we are done receiving/loading the map.
virtual NetworkRecvStatus | Receive_CLIENT_ACK (Packet &p)
| Tell the server we are done with this frame: uint32_t Current frame counter of the client.
virtual NetworkRecvStatus | Receive_CLIENT_COMMAND (Packet &p)
| Send a DoCommand to the Server: uint8_t ID of the company (0..MAX_COMPANIES-1).
virtual NetworkRecvStatus | Receive_CLIENT_CHAT (Packet &p)
| Sends a chat-packet to the server: uint8_t ID of the action (see NetworkAction).
virtual NetworkRecvStatus | Receive_CLIENT_SET_NAME (Packet &p)
| Gives the client a new name: string New name of the client.
virtual NetworkRecvStatus | Receive_CLIENT_QUIT (Packet &p)
| The client is quitting the game.
virtual NetworkRecvStatus | Receive_CLIENT_ERROR (Packet &p)
| The client made an error and is quitting the game.
virtual NetworkRecvStatus | Receive_CLIENT_RCON (Packet &p)
| Send an RCon command to the server: string RCon password.
virtual NetworkRecvStatus | Receive_CLIENT_NEWGRFS_CHECKED (Packet &p)
| Tell the server that we have the required GRFs.
virtual NetworkRecvStatus | Receive_CLIENT_MOVE (Packet &p)
| Request the server to move this client into another company: uint8_t ID of the company the client wants to join.
NetworkRecvStatus | HandlePacket (Packet &p)
| Handle the given packet, i.e.
| NetworkGameSocketHandler (SOCKET s)
| Create a new socket for the game connection.

## Static Protected Member Functions
static NetworkRecvStatus | SendNewGRFsOk ()
| Tell the server we got all the NewGRFs.
static NetworkRecvStatus | SendGetMap ()
| Request the map from the server.
static NetworkRecvStatus | SendMapOk ()
| Tell the server we received the complete map.
static NetworkRecvStatus | SendIdentify ()

## Static Protected Attributes
static ClientNetworkGameSocketHandler * | my_client = nullptr
| This is us!

## Private Types
enum | ServerStatus { STATUS_INACTIVE , STATUS_JOIN , STATUS_AUTH_GAME , STATUS_ENCRYPTED , STATUS_NEWGRFS_CHECK , STATUS_AUTHORIZED , STATUS_MAP_WAIT , STATUS_MAP , STATUS_ACTIVE , STATUS_END }
| Status of the connection with the server. More...

## Private Attributes
std::unique_ptr< class NetworkAuthenticationClientHandler > | authentication_handler
| The handler for the authentication.
std::string | connection_string
| Address we are connected to.
std::shared_ptr< struct PacketReader > | savegame
| Packet reader for reading the savegame.
uint8_t | token
| The token we need to send back to the server to prove we're the right client.
ServerStatus | status
| Status of the connection with the server.

## Friends
void | NetworkExecuteLocalCommandQueue ()
| Execute all commands on the local command queue that ought to be executed this frame.
void | NetworkClose (bool close_admins)
| Close current connections.

## Additional Inherited Members
Data Fields inherited from NetworkGameSocketHandler
ClientID | client_id
| Client identifier.
uint32_t | last_frame
| Last frame we have executed.
uint32_t | last_frame_server
| Last frame the server has executed.
CommandQueue | incoming_queue
| The command-queue awaiting handling.
std::chrono::steady_clock::time_point | last_packet
| Time we received the last frame.
Data Fields inherited from NetworkTCPSocketHandler
SOCKET | sock
| The socket currently connected to.
bool | writable
| Can we write to this socket?
Protected Attributes inherited from NetworkSocketHandler
std::unique_ptr< class NetworkEncryptionHandler > | receive_encryption_handler
| The handler for decrypting received packets.
std::unique_ptr< class NetworkEncryptionHandler > | send_encryption_handler
| The handler for encrypting sent packets.

## Detailed Description

Class for handling the client side of the game connection.

Definition at line 16 of file network_client.h.

## Member Enumeration Documentation

## ◆ ServerStatus

enum ClientNetworkGameSocketHandler::ServerStatus
| private

Status of the connection with the server.

Enumerator
STATUS_INACTIVE | The client is not connected nor active.
STATUS_JOIN | We are trying to join a server.
STATUS_AUTH_GAME | Last action was requesting game (server) password.
STATUS_ENCRYPTED | The game authentication has completed and from here on the connection to the server is encrypted.
STATUS_NEWGRFS_CHECK | Last action was checking NewGRFs.
STATUS_AUTHORIZED | The client is authorized at the server.
STATUS_MAP_WAIT | The client is waiting as someone else is downloading the map.
STATUS_MAP | The client is downloading the map.
STATUS_ACTIVE | The client is active within in the game.
STATUS_END | Must ALWAYS be on the end of this list!! (period)

Definition at line 24 of file network_client.h.

## Constructor & Destructor Documentation

## ◆ ClientNetworkGameSocketHandler()

ClientNetworkGameSocketHandler::ClientNetworkGameSocketHandler | ( | SOCKET | s,
|  | const std::string & | connection_string
| ) |  |

Create a new socket for the client side of the game connection.

Parameters

  s | The socket to connect with.

Definition at line 146 of file network_client.cpp.

References my_client.

## ◆ ~ClientNetworkGameSocketHandler()

ClientNetworkGameSocketHandler::~ClientNetworkGameSocketHandler | ( |  | ) |

Clear whatever we assigned.

Definition at line 153 of file network_client.cpp.

References NetworkGameSocketHandler::GetInfo(), and my_client.

## Member Function Documentation

## ◆ CheckConnection()

void ClientNetworkGameSocketHandler::CheckConnection | ( |  | ) |
| protected

Check the connection's state, i.e.

is the connection still up?

Definition at line 1202 of file network_client.cpp.

References NetworkGameSocketHandler::CloseConnection(), NetworkGameSocketHandler::last_packet, SetDParam(), ShowErrorMessage(), status, STATUS_AUTHORIZED, and WL_INFO.

Referenced by Send().

## ◆ ClientError()

void ClientNetworkGameSocketHandler::ClientError | ( | NetworkRecvStatus | res | ) |

Handle an error coming from the client side.

Parameters

  res | The "error" that happened.

Definition at line 189 of file network_client.cpp.

References _networking, _switch_mode, ClientNetworkEmergencySave(), CloseConnection(), CloseWindowById(), NetworkSocketHandler::MarkClosed(), NETWORK_RECV_STATUS_CLOSE_QUERY, NETWORK_RECV_STATUS_DESYNC, NETWORK_RECV_STATUS_NEWGRF_MISMATCH, NETWORK_RECV_STATUS_SAVEGAME, NETWORK_RECV_STATUS_SERVER_BANNED, NETWORK_RECV_STATUS_SERVER_ERROR, NETWORK_RECV_STATUS_SERVER_FULL, SendError(), SM_MENU, WC_NETWORK_STATUS_WINDOW, and WN_NETWORK_STATUS_WINDOW_JOIN.

Referenced by GameLoop(), and Receive().

## ◆ CloseConnection()

NetworkRecvStatus ClientNetworkGameSocketHandler::CloseConnection | ( | NetworkRecvStatus | status | ) |
| overridevirtual

Close the network connection due to the given status.

Parameters

  status | The reason the connection got closed.

Implements NetworkGameSocketHandler.

Definition at line 161 of file network_client.cpp.

References NetworkGameSocketHandler::client_id, CSleep(), Debug, NetworkSocketHandler::HasClientQuit(), MILLISECONDS_PER_TICK, NETWORK_RECV_STATUS_OKAY, NetworkTCPSocketHandler::SendPackets(), NetworkTCPSocketHandler::sock, and status.

Referenced by ClientError().

## ◆ GameLoop()

bool ClientNetworkGameSocketHandler::GameLoop | ( |  | ) |
| static

Actual game loop for the client.

Returns
  Whether everything went okay, or not.

Definition at line 268 of file network_client.cpp.

References _frame_counter, _network_first_time, _random, _sync_frame, _sync_seed_1, ClientError(), TimerGameEconomy::date, TimerGameEconomy::date_fract, Debug, my_client, NETWORK_RECV_STATUS_DESYNC, NetworkExecuteLocalCommandQueue, SendAck(), Randomizer::state, and StateGameLoop().

## ◆ IsConnected()

bool ClientNetworkGameSocketHandler::IsConnected | ( |  | ) |
| static

Check whether the client is actually connected (and in the game).

Returns
  True when the client is connected.

Definition at line 528 of file network_client.cpp.

References my_client, status, and STATUS_ACTIVE.

Referenced by DEF_CONSOLE_HOOK().

## ◆ Receive()

bool ClientNetworkGameSocketHandler::Receive | ( |  | ) |
| static

Check whether we received/can send some data from/to the server and when that's the case handle it appropriately.

Returns
  true when everything went okay.

Definition at line 243 of file network_client.cpp.

References _networking, NetworkTCPSocketHandler::CanSendReceive(), ClientError(), my_client, NETWORK_RECV_STATUS_OKAY, and NetworkGameSocketHandler::ReceivePackets().

Referenced by NetworkReceive().

## ◆ Receive_SERVER_AUTH_REQUEST()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_AUTH_REQUEST | ( | Packet & | p | ) |
| overrideprotectedvirtual

Indication to the client that it needs to authenticate: uint8_t The `NetworkAuthenticationMethod` to use.

32 * uint8_t Public key of the server. 24 * uint8_t Nonce for the key exchange.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 718 of file network_client.cpp.

References _settings_client, authentication_handler, NetworkAuthenticationClientHandler::AWAIT_USER_INPUT, NetworkSettings::client_public_key, NetworkSettings::client_secret_key, NetworkAuthenticationClientHandler::Create(), Debug, NetworkAuthenticationClientHandler::INVALID, ClientSettings::network, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, NetworkAuthenticationClientHandler::READY_FOR_RESPONSE, SendAuthResponse(), status, STATUS_AUTH_GAME, and STATUS_JOIN.

## ◆ Receive_SERVER_BANNED()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED | ( | Packet & | p | ) |
| overrideprotectedvirtual

Notification that the client trying to join is banned.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 550 of file network_client.cpp.

References Debug, INVALID_STRING_ID, NETWORK_RECV_STATUS_SERVER_BANNED, ShowErrorMessage(), and WL_CRITICAL.

## ◆ Receive_SERVER_CHAT()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CHAT | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends a chat-packet to the client: uint8_t ID of the action (see NetworkAction).

uint32_t ID of the client (origin of the chat). string Message (max NETWORK_CHAT_LENGTH). uint64_t data (used e.g. for 'give money' actions).

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 977 of file network_client.cpp.

References _network_own_client_id, NetworkGameSocketHandler::client_id, NetworkClientInfo::client_playas, Debug, NetworkClientInfo::GetByClientID(), GetDrawStringCompanyColour(), GetString(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), NETWORK_CHAT_LENGTH, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_bool(), Packet::Recv_string(), Packet::Recv_uint32(), Packet::Recv_uint64(), Packet::Recv_uint8(), SetDParam(), status, and STATUS_ACTIVE.

## ◆ Receive_SERVER_CHECK_NEWGRFS()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends information about all used GRFs to the client: uint8_t Amount of GRFs (the following data is repeated this many times, i.e.

per GRF data). uint32_t GRF ID 16 * uint8_t MD5 checksum of the GRF

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 673 of file network_client.cpp.

References BSWAP32(), Debug, FGCM_EXACT, FindGRFConfig(), FormatArrayAsHex(), GRFIdentifier::grfid, INVALID_STRING_ID, GRFIdentifier::md5sum, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_NEWGRF_MISMATCH, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint8(), SendNewGRFsOk(), ShowErrorMessage(), status, STATUS_ENCRYPTED, and WL_CRITICAL.

## ◆ Receive_SERVER_CLIENT_INFO()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO | ( | Packet & | p | ) |
| overrideprotectedvirtual

Send information about a client: uint32_t ID of the client (always unique on a server.

1 = server, 0 is invalid). uint8_t ID of the company the client is playing as (255 for spectators). string Name of the client. string Public key of the client.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 563 of file network_client.cpp.

References _network_own_client_id, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientinfo_pool >::CanAllocateItem(), CC_DEFAULT, NetworkGameSocketHandler::client_id, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, COMPANY_SPECTATOR, Debug, NetworkClientInfo::GetByClientID(), NetworkSocketHandler::HasClientQuit(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), NETWORK_NAME_LENGTH, NETWORK_PUBLIC_KEY_LENGTH, NETWORK_RECV_STATUS_CLIENT_QUIT, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, NetworkIsValidClientName(), NetworkClientInfo::public_key, Packet::Recv_string(), Packet::Recv_uint32(), Packet::Recv_uint8(), NetworkGameSocketHandler::SetInfo(), SetLocalCompany(), status, STATUS_AUTHORIZED, and WC_CLIENT_LIST.

## ◆ Receive_SERVER_COMMAND()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_COMMAND | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends a DoCommand to the client: uint8_t ID of the company (0..MAX_COMPANIES-1).

uint32_t ID of the command (see command.h). Command specific buffer with encoded parameters of variable length. The content differs per command and can change without notification. uint8_t ID of the callback. uint32_t Frame of execution.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 956 of file network_client.cpp.

References CC_WARNING, CommandPacket::cmd, Debug, CommandPacket::frame, IConsolePrint(), NetworkGameSocketHandler::incoming_queue, CommandPacket::my_cmd, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, NetworkGameSocketHandler::ReceiveCommand(), Packet::Recv_bool(), Packet::Recv_uint32(), status, and STATUS_ACTIVE.

## ◆ Receive_SERVER_CONFIG_UPDATE()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CONFIG_UPDATE | ( | Packet & | p | ) |
| overrideprotectedvirtual

Update the clients knowledge of the max settings: uint8_t Maximum number of companies allowed.

uint8_t Maximum number of spectators allowed.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1185 of file network_client.cpp.

References _network_server_max_companies, _network_server_name, Debug, InvalidateWindowData(), NETWORK_NAME_LENGTH, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_string(), Packet::Recv_uint8(), status, STATUS_ACTIVE, and WC_CLIENT_LIST.

## ◆ Receive_SERVER_ENABLE_ENCRYPTION()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_ENABLE_ENCRYPTION | ( | Packet & | p | ) |
| overrideprotectedvirtual

Indication to the client that authentication is complete and encryption has to be used from here on forward.

The encryption uses the shared keys generated by the last AUTH_REQUEST key exchange. 24 * uint8_t Nonce for encrypted connection.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 743 of file network_client.cpp.

References authentication_handler, Debug, NETWORK_RECV_STATUS_MALFORMED_PACKET, NetworkSocketHandler::receive_encryption_handler, NetworkSocketHandler::send_encryption_handler, status, STATUS_AUTH_GAME, and STATUS_ENCRYPTED.

## ◆ Receive_SERVER_ERROR()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_ERROR | ( | Packet & | p | ) |
| overrideprotectedvirtual

The client made an error: uint8_t Error code caused (see NetworkErrorCode).

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 624 of file network_client.cpp.

References Packet::CanReadFromPacket(), ClientNetworkEmergencySave(), Debug, INVALID_STRING_ID, lengthof, NETWORK_CHAT_LENGTH, NETWORK_RECV_STATUS_SERVER_ERROR, Packet::Recv_string(), Packet::Recv_uint8(), SetDParamStr(), ShowErrorMessage(), status, STATUS_ACTIVE, and WL_CRITICAL.

## ◆ Receive_SERVER_ERROR_QUIT()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_ERROR_QUIT | ( | Packet & | p | ) |
| overrideprotectedvirtual

Inform all clients that one client made an error and thus has quit/been disconnected: uint32_t ID of the client that caused the error.

uint8_t Code of the error caused (see NetworkErrorCode).

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1046 of file network_client.cpp.

References CC_DEFAULT, NetworkGameSocketHandler::client_id, NetworkClientInfo::client_name, Debug, NetworkClientInfo::GetByClientID(), GetNetworkErrorMsg(), InvalidateWindowData(), NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), Packet::Recv_uint8(), status, STATUS_AUTHORIZED, and WC_CLIENT_LIST.

## ◆ Receive_SERVER_EXTERNAL_CHAT()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_EXTERNAL_CHAT | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends a chat-packet for external source to the client: string Name of the source this message came from.

uint16_t TextColour to use for the message. string Name of the user who sent the messsage. string Message (max NETWORK_CHAT_LENGTH).

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1028 of file network_client.cpp.

References Debug, IsValidConsoleColour(), NETWORK_CHAT_LENGTH, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_string(), Packet::Recv_uint16(), status, and STATUS_ACTIVE.

## ◆ Receive_SERVER_FRAME()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FRAME | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends the current frame counter to the client: uint32_t Frame counter uint32_t Frame counter max (how far may the client walk before the server?) uint32_t General seed 1 (dependent on compile settings, not default).

uint32_t General seed 2 (dependent on compile settings, not default). uint8_t Random token to validate the client is actually listening (only occasionally present).

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 906 of file network_client.cpp.

References _frame_counter, _frame_counter_max, _frame_counter_server, _network_first_time, _sync_frame, _sync_seed_1, Packet::CanReadFromPacket(), Ticks::DAY_TICKS, Debug, last_ack_frame, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), Packet::Recv_uint8(), SendAck(), status, STATUS_ACTIVE, and token.

## ◆ Receive_SERVER_FULL()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL | ( | Packet & | p | ) |
| overrideprotectedvirtual

Notification that the server is full.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 540 of file network_client.cpp.

References Debug, INVALID_STRING_ID, NETWORK_RECV_STATUS_SERVER_FULL, ShowErrorMessage(), and WL_CRITICAL.

## ◆ Receive_SERVER_JOIN()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_JOIN | ( | Packet & | p | ) |
| overrideprotectedvirtual

A client joined (PACKET_CLIENT_MAP_OK), what usually directly follows is a PACKET_SERVER_CLIENT_INFO: uint32_t ID of the client that just joined the game.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1087 of file network_client.cpp.

References CC_DEFAULT, NetworkGameSocketHandler::client_id, NetworkClientInfo::client_name, Debug, NetworkClientInfo::GetByClientID(), InvalidateWindowData(), NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), status, STATUS_AUTHORIZED, and WC_CLIENT_LIST.

## ◆ Receive_SERVER_MAP_BEGIN()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends that the server will begin with sending the map to the client: uint32_t Current frame.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 791 of file network_client.cpp.

References _frame_counter, _frame_counter_max, _frame_counter_server, _network_join_bytes, _network_join_bytes_total, _network_join_status, Debug, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), savegame, SetWindowDirty(), status, STATUS_MAP, WC_NETWORK_STATUS_WINDOW, and WN_NETWORK_STATUS_WINDOW_JOIN.

## ◆ Receive_SERVER_MAP_DATA()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DATA | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends the data of the map to the client: Contains a part of the map (until max size of packet).

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 828 of file network_client.cpp.

References _network_join_bytes, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, savegame, SetWindowDirty(), status, STATUS_MAP, WC_NETWORK_STATUS_WINDOW, and WN_NETWORK_STATUS_WINDOW_JOIN.

## ◆ Receive_SERVER_MAP_DONE()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends that all data of the map are sent to the client:

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 842 of file network_client.cpp.

References _file_to_saveload, _game_session_stats, _network_join, _network_join_status, _network_own_client_id, CCA_NEW, ClearErrorMessages(), NetworkJoinInfo::company, COMPANY_NEW_COMPANY, COMPANY_SPECTATOR, CRR_NONE, Debug, DFT_GAME_FILE, SocialIntegration::EventEnterMultiplayer(), FT_SAVEGAME, INVALID_COMPANY, INVALID_STRING_ID, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), NetworkGameSocketHandler::last_packet, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, NETWORK_RECV_STATUS_SAVEGAME, NO_DIRECTORY, savegame, GameSessionStats::savegame_size, SendMapOk(), SetLocalCompany(), FileToSaveLoad::SetMode(), SetWindowDirty(), ShowErrorMessage(), Map::SizeX(), Map::SizeY(), SLO_LOAD, GameSessionStats::start_time, status, STATUS_MAP, WC_NETWORK_STATUS_WINDOW, WL_CRITICAL, and WN_NETWORK_STATUS_WINDOW_JOIN.

## ◆ Receive_SERVER_MAP_SIZE()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_SIZE | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends the size of the map to the client.

uint32_t Size of the (compressed) map (in bytes).

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 815 of file network_client.cpp.

References _network_join_bytes_total, Debug, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), savegame, SetWindowDirty(), status, STATUS_MAP, WC_NETWORK_STATUS_WINDOW, and WN_NETWORK_STATUS_WINDOW_JOIN.

## ◆ Receive_SERVER_MOVE()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MOVE | ( | Packet & | p | ) |
| overrideprotectedvirtual

Move a client from one company into another: uint32_t ID of the client.

uint8_t ID of the new company.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1155 of file network_client.cpp.

References _network_own_client_id, NetworkGameSocketHandler::client_id, COMPANY_SPECTATOR, Debug, NetworkClientInfo::GetByClientID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), Packet::Recv_uint8(), SetLocalCompany(), status, and STATUS_AUTHORIZED.

## ◆ Receive_SERVER_NEWGAME()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME | ( | Packet & | p | ) |
| overrideprotectedvirtual

Let the clients know that the server is loading a new map.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1120 of file network_client.cpp.

References _network_own_client_id, _network_reconnect, ClientNetworkEmergencySave(), Debug, INVALID_STRING_ID, NETWORK_RECV_STATUS_SERVER_ERROR, ShowErrorMessage(), status, STATUS_ACTIVE, STATUS_JOIN, and WL_CRITICAL.

## ◆ Receive_SERVER_QUIT()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_QUIT | ( | Packet & | p | ) |
| overrideprotectedvirtual

Notification that a client left the game: uint32_t ID of the client.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1065 of file network_client.cpp.

References CC_DEFAULT, NetworkGameSocketHandler::client_id, NetworkClientInfo::client_name, Debug, NetworkClientInfo::GetByClientID(), InvalidateWindowData(), NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), status, STATUS_AUTHORIZED, and WC_CLIENT_LIST.

## ◆ Receive_SERVER_RCON()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_RCON | ( | Packet & | p | ) |
| overrideprotectedvirtual

Send the result of an issues RCon command back to the client: uint16_t Colour code.

string Output of the RCon command

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1139 of file network_client.cpp.

References Debug, IConsolePrint(), IsValidConsoleColour(), NETWORK_RCONCOMMAND_LENGTH, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_string(), Packet::Recv_uint16(), status, and STATUS_AUTHORIZED.

## ◆ Receive_SERVER_SHUTDOWN()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN | ( | Packet & | p | ) |
| overrideprotectedvirtual

Let the clients know that the server is closing.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1105 of file network_client.cpp.

References ClientNetworkEmergencySave(), Debug, INVALID_STRING_ID, NETWORK_RECV_STATUS_SERVER_ERROR, ShowErrorMessage(), status, STATUS_ACTIVE, STATUS_JOIN, and WL_CRITICAL.

## ◆ Receive_SERVER_SYNC()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SYNC | ( | Packet & | p | ) |
| overrideprotectedvirtual

Sends a sync-check to the client: uint32_t Frame counter.

uint32_t General seed 1. uint32_t General seed 2 (dependent on compile settings, not default).

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 941 of file network_client.cpp.

References _sync_frame, _sync_seed_1, Debug, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), status, and STATUS_ACTIVE.

## ◆ Receive_SERVER_WAIT()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_WAIT | ( | Packet & | p | ) |
| overrideprotectedvirtual

Notification that another client is currently receiving the map: uint8_t Number of clients waiting in front of you.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 775 of file network_client.cpp.

References _network_join_status, _network_join_waiting, Debug, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint8(), SetWindowDirty(), status, STATUS_MAP_WAIT, WC_NETWORK_STATUS_WINDOW, and WN_NETWORK_STATUS_WINDOW_JOIN.

## ◆ Receive_SERVER_WELCOME()

NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_WELCOME | ( | Packet & | p | ) |
| overrideprotectedvirtual

The client is joined and ready to receive their map: uint32_t Own client ID.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 761 of file network_client.cpp.

References _network_own_client_id, Debug, NETWORK_RECV_STATUS_MALFORMED_PACKET, Packet::Recv_uint32(), SendGetMap(), status, and STATUS_AUTHORIZED.

## ◆ Send()

void ClientNetworkGameSocketHandler::Send | ( |  | ) |
| static

Send the packets of this socket handler.

Definition at line 258 of file network_client.cpp.

References CheckConnection(), my_client, and NetworkTCPSocketHandler::SendPackets().

## ◆ SendAck()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendAck | ( |  | ) |
| static

Send an acknowledgement from the server's ticks.

Definition at line 410 of file network_client.cpp.

References _frame_counter, Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_ACK, NetworkTCPSocketHandler::SendPacket(), and token.

Referenced by GameLoop(), and Receive_SERVER_FRAME().

## ◆ SendAuthResponse()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendAuthResponse | ( |  | ) |
| static

Set the game password as requested.

Parameters

  password | The game password.

Definition at line 372 of file network_client.cpp.

References authentication_handler, Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_AUTH_RESPONSE, and NetworkTCPSocketHandler::SendPacket().

Referenced by Receive_SERVER_AUTH_REQUEST(), and ClientGamePasswordRequestHandler::SendResponse().

## ◆ SendChat()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendChat | ( | NetworkAction | action,
|  | DestType | type,
|  | int | dest,
|  | const std::string & | msg,
|  | int64_t | data
| ) |  |
| static

Send a chat-packet over the network.

Definition at line 438 of file network_client.cpp.

References Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_CHAT, and NetworkTCPSocketHandler::SendPacket().

Referenced by NetworkClientSendChat(), and SendChat().

## ◆ SendCommand()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendCommand | ( | const CommandPacket & | cp | ) |
| static

Send a command to the server.

Parameters

  cp | The command to send.

Definition at line 426 of file network_client.cpp.

References CommandPacket::cmd, Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_COMMAND, and NetworkTCPSocketHandler::SendPacket().

Referenced by NetworkSendCommand().

## ◆ SendError()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendError | ( | NetworkErrorCode | errorno | ) |
| static

Send an error-packet over the network.

Definition at line 455 of file network_client.cpp.

References Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_ERROR, and NetworkTCPSocketHandler::SendPacket().

Referenced by ClientError().

## ◆ SendGetMap()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendGetMap | ( |  | ) |
| staticprotected

Request the map from the server.

Definition at line 384 of file network_client.cpp.

References Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_GETMAP, NetworkTCPSocketHandler::SendPacket(), status, and STATUS_MAP_WAIT.

Referenced by Receive_SERVER_WELCOME().

## ◆ SendIdentify()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendIdentify | ( |  | ) |
| staticprotected

Definition at line 347 of file network_client.cpp.

## ◆ SendJoin()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendJoin | ( |  | ) |
| static

Tell the server we would like to join.

Definition at line 329 of file network_client.cpp.

References _network_join_status, Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_JOIN, NetworkTCPSocketHandler::SendPacket(), SetWindowDirty(), status, STATUS_JOIN, WC_NETWORK_STATUS_WINDOW, and WN_NETWORK_STATUS_WINDOW_JOIN.

Referenced by NetworkClient_Connected().

## ◆ SendMapOk()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendMapOk | ( |  | ) |
| staticprotected

Tell the server we received the complete map.

Definition at line 397 of file network_client.cpp.

References Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_MAP_OK, NetworkTCPSocketHandler::SendPacket(), status, and STATUS_ACTIVE.

Referenced by Receive_SERVER_MAP_DONE().

## ◆ SendMove()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendMove | ( | CompanyID | company | ) |
| static

Ask the server to move us.

Parameters

  company | The company to move to.

Definition at line 514 of file network_client.cpp.

References Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_MOVE, and NetworkTCPSocketHandler::SendPacket().

Referenced by NetworkClientRequestMove().

## ◆ SendNewGRFsOk()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendNewGRFsOk | ( |  | ) |
| staticprotected

Tell the server we got all the NewGRFs.

Definition at line 359 of file network_client.cpp.

References Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_NEWGRFS_CHECKED, and NetworkTCPSocketHandler::SendPacket().

Referenced by Receive_SERVER_CHECK_NEWGRFS().

## ◆ SendQuit()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendQuit | ( |  | ) |
| static

Tell the server we would like to quit.

Definition at line 484 of file network_client.cpp.

References Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_QUIT, and NetworkTCPSocketHandler::SendPacket().

## ◆ SendRCon()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendRCon | ( | const std::string & | pass,
|  | const std::string & | command
| ) |  |
| static

Send a console command.

Parameters

  pass | The password for the remote command.
  command | The actual command.

Definition at line 499 of file network_client.cpp.

References Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_RCON, and NetworkTCPSocketHandler::SendPacket().

Referenced by NetworkClientSendRcon().

## ◆ SendSetName()

NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetName | ( | const std::string & | name | ) |
| static

Tell the server that we like to change the name of the client.

Parameters

  name | The new name.

Definition at line 470 of file network_client.cpp.

References Debug, my_client, NETWORK_RECV_STATUS_OKAY, PACKET_CLIENT_SET_NAME, and NetworkTCPSocketHandler::SendPacket().

Referenced by NetworkUpdateClientName().

## Friends And Related Symbol Documentation

## ◆ NetworkClose

void NetworkClose | ( | bool | close_admins | ) |
| friend

Close current connections.

Parameters

  close_admins | Whether the admin connections have to be closed as well.

Definition at line 592 of file network.cpp.

## ◆ NetworkExecuteLocalCommandQueue

void NetworkExecuteLocalCommandQueue | ( |  | ) |
| friend

Execute all commands on the local command queue that ought to be executed this frame.

Definition at line 245 of file network_command.cpp.

Referenced by GameLoop().

## Field Documentation

## ◆ authentication_handler

std::unique_ptr<class NetworkAuthenticationClientHandler> ClientNetworkGameSocketHandler::authentication_handler
| private

The handler for the authentication.

Definition at line 18 of file network_client.h.

Referenced by Receive_SERVER_AUTH_REQUEST(), Receive_SERVER_ENABLE_ENCRYPTION(), and SendAuthResponse().

## ◆ connection_string

std::string ClientNetworkGameSocketHandler::connection_string
| private

Address we are connected to.

Definition at line 19 of file network_client.h.

## ◆ my_client

ClientNetworkGameSocketHandler * ClientNetworkGameSocketHandler::my_client = nullptr
| staticprotected

This is us!

Our client's connection.

Definition at line 42 of file network_client.h.

Referenced by ClientNetworkGameSocketHandler(), GameLoop(), IsConnected(), Receive(), Send(), SendAck(), SendAuthResponse(), SendChat(), SendCommand(), SendError(), SendGetMap(), SendJoin(), SendMapOk(), SendMove(), SendNewGRFsOk(), SendQuit(), SendRCon(), SendSetName(), and ~ClientNetworkGameSocketHandler().

## ◆ savegame

std::shared_ptr<struct PacketReader> ClientNetworkGameSocketHandler::savegame
| private

Packet reader for reading the savegame.

Definition at line 20 of file network_client.h.

Referenced by Receive_SERVER_MAP_BEGIN(), Receive_SERVER_MAP_DATA(), Receive_SERVER_MAP_DONE(), and Receive_SERVER_MAP_SIZE().

## ◆ status

ServerStatus ClientNetworkGameSocketHandler::status
| private

Status of the connection with the server.

Definition at line 37 of file network_client.h.

Referenced by CheckConnection(), CloseConnection(), IsConnected(), Receive_SERVER_AUTH_REQUEST(), Receive_SERVER_CHAT(), Receive_SERVER_CHECK_NEWGRFS(), Receive_SERVER_CLIENT_INFO(), Receive_SERVER_COMMAND(), Receive_SERVER_CONFIG_UPDATE(), Receive_SERVER_ENABLE_ENCRYPTION(), Receive_SERVER_ERROR(), Receive_SERVER_ERROR_QUIT(), Receive_SERVER_EXTERNAL_CHAT(), Receive_SERVER_FRAME(), Receive_SERVER_JOIN(), Receive_SERVER_MAP_BEGIN(), Receive_SERVER_MAP_DATA(), Receive_SERVER_MAP_DONE(), Receive_SERVER_MAP_SIZE(), Receive_SERVER_MOVE(), Receive_SERVER_NEWGAME(), Receive_SERVER_QUIT(), Receive_SERVER_RCON(), Receive_SERVER_SHUTDOWN(), Receive_SERVER_SYNC(), Receive_SERVER_WAIT(), Receive_SERVER_WELCOME(), SendGetMap(), SendJoin(), and SendMapOk().

## ◆ token

uint8_t ClientNetworkGameSocketHandler::token
| private

The token we need to send back to the server to prove we're the right client.

Definition at line 21 of file network_client.h.

Referenced by Receive_SERVER_FRAME(), and SendAck().

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

- src/network/network_client.h
- src/network/network_client.cpp