OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
10 #ifndef NETWORK_FUNC_H
11 #define NETWORK_FUNC_H
22 #include "../console_type.h"
23 #include "../gfx_type.h"
24 #include "../openttd.h"
25 #include "../company_type.h"
38 byte NetworkSpectatorCount();
44 void NetworkGameLoop();
52 void NetworkClientConnectGame(
NetworkAddress address,
CompanyID join_as,
const char *join_server_password =
nullptr,
const char *join_company_password =
nullptr);
69 bool NetworkServerStart();
Simple calculated statistics of a company.
DestType
Destination of our chat messages.
void NetworkServerShowStatusToConsole()
Show the status message of all clients on the console.
void ParseConnectionString(const char **company, const char **port, char *connection_string)
Converts a string to ip/port/company Format: IP:port::company.
bool NetworkCompanyIsPassworded(CompanyID company_id)
Check if the company we want to join requires a password.
void NetworkDisconnect(bool blocking=false, bool close_admins=true)
We want to disconnect from the host/clients.
Some state information of a company, especially for servers.
NetworkAction
Actions that can be used for NetworkTextMessage.
bool NetworkCompanyHasClients(CompanyID company)
Check whether a particular company has clients.
void NetworkPopulateCompanyStats(NetworkCompanyStats *stats)
Populate the company stats.
void NetworkUpdateClientInfo(ClientID client_id)
Send updated client info of a particular client.
void NetworkServerDoMove(ClientID client_id, CompanyID company_id)
Handle the tid-bits of moving a client from one company to another.
void NetworkClientRequestMove(CompanyID company, const char *pass="")
Notify the server of this client wanting to be moved to another company.
The game information that is not generated on-the-fly and has to be sent to the clients.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
void NetworkHandlePauseChange(PauseMode prev_mode, PauseMode changed_mode)
Handle the pause mode change so we send the right messages to the chat.
Owner
Enum for all companies/owners.
StringList _network_bind_list
The addresses to bind on.
const char * NetworkChangeCompanyPassword(CompanyID company_id, const char *password)
Change the company password of a given company.
void NetworkServerDailyLoop()
Daily "callback".
bool NetworkMaxSpectatorsReached()
Check if max_spectatos has been reached on the server (local check only).
ClientID
'Unique' identifier to be given to clients
void NetworkServerYearlyLoop()
Yearly "callback".
void NetworkPrintClients()
Print all the clients to the console.
std::vector< std::string > StringList
Type for a list of strings.
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio)
Tell whether the client has team members where he/she can chat to.
void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const char *string)
Send an rcon reply to the client.
PauseMode
Modes of pausing we've got.
bool NetworkMaxCompaniesReached()
Check if max_companies has been reached on the server (local check only).
void NetworkClientSendRcon(const char *password, const char *command)
Send a remote console command.
StringList _network_host_list
The servers we know.
bool NetworkServerChangeClientName(ClientID client_id, const char *new_name)
Change the client name of the given client.
void NetworkServerKickClient(ClientID client_id, const char *reason)
Kick a single client.
void NetworkBackgroundLoop()
We have to do some (simple) background stuff that runs normally, even when we are not in multiplayer.
Wrapper for (un)resolved network addresses; there's no reason to transform a numeric IP to a string a...
void NetworkUpdateClientName()
Send the server our name.
void NetworkServerSendConfigUpdate()
Send Config Update.
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg, int64 data=0)
Send a chat message.
bool _network_need_advertise
Whether we need to advertise.
void NetworkServerNewCompany(const Company *company, NetworkClientInfo *ci)
Perform all the server specific administration of a new company.
void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, ClientID from_id, int64 data=0, bool from_admin=false)
Send an actual chat message.
uint NetworkServerKickOrBanIP(ClientID client_id, bool ban, const char *reason)
Ban, or kick, everyone joined from the given client's IP.
NetworkServerGameInfo _network_game_info
Uncomment the following define to enable command replaying.
ClientID _network_own_client_id
Our client identifier.
void NetworkClientsToSpectators(CompanyID cid)
Move the clients of a company to the spectators.
StringList _network_ban_list
The banned clients.
void NetworkChatMessageLoop()
Check if a message is expired.
void NetworkAfterNewGRFScan()
Rebuild the GRFConfig's of the servers in the game list as we did a rescan and might have found new N...
void CDECL void NetworkUndrawChatMessage()
Hide the chatbox.
ClientID _redirect_console_to_client
If not invalid, redirect the console output to a client.
void NetworkServerMonthlyLoop()
Monthly "callback".
Container for all information known about a client.
void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const char *message,...)
Add a text message to the 'chat window' to be shown.
NetworkCompanyState * _network_company_states
Statistics about some companies.
uint8 _network_reconnect
Reconnect timeout.
void NetworkInitChatMessage()
Initialize all buffers of the chat visualisation.