Client part of the network protocol. More...
#include "../stdafx.h"#include "network_gui.h"#include "../saveload/saveload.h"#include "../saveload/saveload_filter.h"#include "../command_func.h"#include "../console_func.h"#include "../strings_func.h"#include "../window_func.h"#include "../company_func.h"#include "../company_base.h"#include "../company_gui.h"#include "../core/random_func.hpp"#include "../date_func.h"#include "../gfx_func.h"#include "../error.h"#include "../rev.h"#include "network.h"#include "network_base.h"#include "network_client.h"#include "../core/backup_type.hpp"#include "table/strings.h"Go to the source code of this file.
Data Structures | |
| struct | PacketReader |
| Read some packets, and when do use that data as initial load filter. More... | |
Functions | |
| assert_compile (NETWORK_SERVER_ID_LENGTH==16 *2+1) | |
| Make sure the server ID length is the same as a md5 hash. | |
| bool | SafeLoad (const char *filename, int mode, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf=NULL) |
| Load the specified savegame but on error do different things. | |
| void | NetworkClient_Connected () |
| Is called after a client is connected to the server. | |
| void | NetworkClientSendRcon (const char *password, const char *command) |
| Send a remote console command. | |
| void | NetworkClientRequestMove (CompanyID company_id, const char *pass) |
| Notify the server of this client wanting to be moved to another company. | |
| void | NetworkClientsToSpectators (CompanyID cid) |
| Move the clients of a company to the spectators. | |
| void | NetworkUpdateClientName () |
| Send the server our name. | |
| void | NetworkClientSendChat (NetworkAction action, DestType type, int dest, const char *msg, int64 data) |
| Send a chat message. | |
| void | NetworkClientSetCompanyPassword (const char *password) |
| Set/Reset company password on the client side. | |
| bool | NetworkClientPreferTeamChat (const NetworkClientInfo *cio) |
| Tell whether the client has team members where he/she can chat to. | |
| bool | NetworkMaxCompaniesReached () |
| Check if max_companies has been reached on the server (local check only). | |
| bool | NetworkMaxSpectatorsReached () |
| Check if max_spectatos has been reached on the server (local check only). | |
Variables | |
| static uint32 | last_ack_frame |
| Last frame we performed an ack. | |
| static uint32 | _password_game_seed |
| One bit of 'entropy' used to generate a salt for the company passwords. | |
| static char | _password_server_id [NETWORK_SERVER_ID_LENGTH] |
| The other bit of 'entropy' used to generate a salt for the company passwords. | |
| static uint8 | _network_server_max_companies |
| Maximum number of companies of the currently joined server. | |
| static uint8 | _network_server_max_spectators |
| Maximum number of spectators of the currently joined server. | |
| CompanyID | _network_join_as |
| Who would we like to join as. | |
| const char * | _network_join_server_password = NULL |
| Login password from -p argument. | |
| const char * | _network_join_company_password = NULL |
| Company password from -P argument. | |
Client part of the network protocol.
Definition in file network_client.cpp.
| assert_compile | ( | NETWORK_SERVER_ID_LENGTH | = =16 *2+1 |
) |
Make sure the server ID length is the same as a md5 hash.
| bool NetworkClientPreferTeamChat | ( | const NetworkClientInfo * | cio | ) |
Tell whether the client has team members where he/she can chat to.
| cio | client to check members of. |
Definition at line 1268 of file network_client.cpp.
References _settings_client, NetworkClientInfo::client_playas, FOR_ALL_CLIENT_INFOS, ClientSettings::gui, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and GUISettings::prefer_teamchat.
Referenced by MainWindow::OnKeyPress().
| void NetworkClientRequestMove | ( | CompanyID | company_id, | |
| const char * | pass | |||
| ) |
Notify the server of this client wanting to be moved to another company.
| company_id | id of the company the client wishes to be moved to. | |
| pass | the password, is only checked on the server end if a password is needed. |
Definition at line 1193 of file network_client.cpp.
References ClientNetworkGameSocketHandler::SendMove().
Referenced by MenuClickCompany(), CompanyWindow::OnClick(), and CompanyWindow::OnQueryTextFinished().
| void NetworkClientSendChat | ( | NetworkAction | action, | |
| DestType | type, | |||
| int | dest, | |||
| const char * | msg, | |||
| int64 | data | |||
| ) |
Send a chat message.
| action | The action associated with the message. | |
| type | The destination type. | |
| dest | The destination index, be it a company index or client id. | |
| msg | The actual message. | |
| data | Arbitrary extra data. |
Definition at line 1249 of file network_client.cpp.
References ClientNetworkGameSocketHandler::SendChat().
| void NetworkClientSendRcon | ( | const char * | password, | |
| const char * | command | |||
| ) |
Send a remote console command.
| password | The password. | |
| command | The command to execute. |
Definition at line 1182 of file network_client.cpp.
References ClientNetworkGameSocketHandler::SendRCon().
| void NetworkClientSetCompanyPassword | ( | const char * | password | ) |
Set/Reset company password on the client side.
| password | Password to be set. |
Definition at line 1258 of file network_client.cpp.
References ClientNetworkGameSocketHandler::SendSetPassword().
Referenced by NetworkChangeCompanyPassword().
| void NetworkClientsToSpectators | ( | CompanyID | cid | ) |
Move the clients of a company to the spectators.
| cid | The company to move the clients of. |
Definition at line 1202 of file network_client.cpp.
References _current_company, _local_company, CC_DEFAULT, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, COMPANY_SPECTATOR, FOR_ALL_CLIENT_INFOS, Backup< T >::Restore(), and SetLocalCompany().
Referenced by ChangeOwnershipOfCompanyItems().
| bool NetworkMaxCompaniesReached | ( | ) |
Check if max_companies has been reached on the server (local check only).
Definition at line 1285 of file network_client.cpp.
References _network_server, _settings_client, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetNumItems(), NetworkSettings::max_companies, and ClientSettings::network.
Referenced by PopupMainCompanyToolbMenu().
| bool NetworkMaxSpectatorsReached | ( | ) |
Check if max_spectatos has been reached on the server (local check only).
Definition at line 1294 of file network_client.cpp.
References _network_server, _settings_client, NetworkSettings::max_spectators, and ClientSettings::network.
Referenced by PopupMainCompanyToolbMenu().
| bool SafeLoad | ( | const char * | filename, | |
| int | mode, | |||
| GameMode | newgm, | |||
| Subdirectory | subdir, | |||
| struct LoadFilter * | lf = NULL | |||
| ) |
Load the specified savegame but on error do different things.
If loading fails due to corrupt savegame, bad version, etc. go back to a previous correct state. In the menu for example load the intro game again.
| mode | mode of loading, either SL_LOAD or SL_OLD_LOAD | |
| newgm | switch to this mode of loading fails due to some unknown error | |
| filename | file to be loaded | |
| subdir | default directory to look for filename, set to 0 if not needed | |
| lf | Load filter to use, if NULL: use filename + subdir. |
Definition at line 954 of file openttd.cpp.
Referenced by VideoDriver_Dedicated::MainLoop(), and ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE().
Who would we like to join as.
Definition at line 296 of file network_client.cpp.
uint8 _network_server_max_companies [static] |
Maximum number of companies of the currently joined server.
Definition at line 291 of file network_client.cpp.
uint8 _network_server_max_spectators [static] |
Maximum number of spectators of the currently joined server.
Definition at line 293 of file network_client.cpp.
uint32 _password_game_seed [static] |
One bit of 'entropy' used to generate a salt for the company passwords.
Definition at line 286 of file network_client.cpp.
char _password_server_id[NETWORK_SERVER_ID_LENGTH] [static] |
The other bit of 'entropy' used to generate a salt for the company passwords.
Definition at line 288 of file network_client.cpp.
uint32 last_ack_frame [static] |
Last frame we performed an ack.
Definition at line 283 of file network_client.cpp.
1.7.1