12 #ifndef NETWORK_FUNC_H 13 #define NETWORK_FUNC_H 24 #include "../console_type.h" 25 #include "../gfx_type.h" 26 #include "../openttd.h" 27 #include "../company_type.h" 42 byte NetworkSpectatorCount();
48 void NetworkGameLoop();
56 void NetworkClientConnectGame(
NetworkAddress address,
CompanyID join_as,
const char *join_server_password = NULL,
const char *join_company_password = NULL);
73 bool NetworkServerStart();
uint NetworkServerKickOrBanIP(ClientID client_id, bool ban)
Ban, or kick, everyone joined from the given client's IP.
uint8 _network_reconnect
Reconnect timeout.
void NetworkInitChatMessage()
Initialize all buffers of the chat visualisation.
bool NetworkCompanyIsPassworded(CompanyID company_id)
Check if the company we want to join requires a password.
Container for all information known about a client.
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.
The game information that is not generated on-the-fly and has to be sent to the clients.
bool NetworkCompanyHasClients(CompanyID company)
Check whether a particular company has clients.
void NetworkPopulateCompanyStats(NetworkCompanyStats *stats)
Populate the company stats.
void NetworkDisconnect(bool blocking=false, bool close_admins=true)
We want to disconnect from the host/clients.
void NetworkUpdateClientInfo(ClientID client_id)
Send updated client info of a particular client.
Wrapper for (un)resolved network addresses; there's no reason to transform a numeric IP to a string a...
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.
StringList _network_bind_list
The addresses to bind on.
void NetworkHandlePauseChange(PauseMode prev_mode, PauseMode changed_mode)
Handle the pause mode change so we send the right messages to the chat.
void NetworkServerDailyLoop()
Daily "callback".
const char * NetworkChangeCompanyPassword(CompanyID company_id, const char *password)
Change the company password of a given company.
bool NetworkMaxSpectatorsReached()
Check if max_spectatos has been reached on the server (local check only).
void NetworkServerKickClient(ClientID client_id)
Kick a single client.
void NetworkServerYearlyLoop()
Yearly "callback".
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio)
Tell whether the client has team members where he/she can chat to.
void NetworkPrintClients()
Print all the clients to the console.
Wrapper for network addresses.
bool NetworkMaxCompaniesReached()
Check if max_companies has been reached on the server (local check only).
void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const char *string)
Send an rcon reply to the client.
void NetworkClientSendRcon(const char *password, const char *command)
Send a remote console command.
void NetworkBackgroundLoop()
We have to do some (simple) background stuff that runs normally, even when we are not in multiplayer...
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 NetworkUpdateClientName()
Send the server our name.
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.
void NetworkServerSendConfigUpdate()
Send Config Update.
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg, int64 data=0)
Send a chat message.
ClientID _network_own_client_id
Our client identifier.
Types used for networking.
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.
ClientID
'Unique' identifier to be given to clients
NetworkServerGameInfo _network_game_info
Uncomment the following define to enable command replaying.
PauseMode
Modes of pausing we've got.
void NetworkClientsToSpectators(CompanyID cid)
Move the clients of a company to the spectators.
void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const char *message,...)
Add a text message to the 'chat window' to be shown.
void NetworkChatMessageLoop()
Check if a message is expired.
StringList _network_ban_list
The banned clients.
Simple calculated statistics of a company.
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.
void NetworkServerMonthlyLoop()
Monthly "callback".
Some state information of a company, especially for servers.
Owner
Enum for all companies/owners.
ClientID _redirect_console_to_client
If not invalid, redirect the console output to a client.
DestType
Destination of our chat messages.
NetworkCompanyState * _network_company_states
Statistics about some companies.
NetworkAction
Actions that can be used for NetworkTextMessage.