Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef NETWORK_FUNC_H
00013 #define NETWORK_FUNC_H
00014
00019
00020
00021 #include "core/address.h"
00022 #include "network_type.h"
00023 #include "../console_type.h"
00024 #include "../gfx_type.h"
00025 #include "../openttd.h"
00026 #include "../company_type.h"
00027
00028 #ifdef ENABLE_NETWORK
00029
00030 extern NetworkServerGameInfo _network_game_info;
00031 extern NetworkCompanyState *_network_company_states;
00032
00033 extern ClientID _network_own_client_id;
00034 extern ClientID _redirect_console_to_client;
00035 extern bool _network_need_advertise;
00036 extern uint32 _network_last_advertise_frame;
00037 extern uint8 _network_reconnect;
00038 extern StringList _network_bind_list;
00039 extern StringList _network_host_list;
00040 extern StringList _network_ban_list;
00041
00042 byte NetworkSpectatorCount();
00043 void NetworkUpdateClientName();
00044 bool NetworkCompanyHasClients(CompanyID company);
00045 const char *NetworkChangeCompanyPassword(CompanyID company_id, const char *password);
00046 void NetworkReboot();
00047 void NetworkDisconnect(bool blocking = false, bool close_admins = true);
00048 void NetworkGameLoop();
00049 void NetworkBackgroundLoop();
00050 void ParseConnectionString(const char **company, const char **port, char *connection_string);
00051 void NetworkStartDebugLog(NetworkAddress address);
00052 void NetworkPopulateCompanyStats(NetworkCompanyStats *stats);
00053
00054 void NetworkUpdateClientInfo(ClientID client_id);
00055 void NetworkClientsToSpectators(CompanyID cid);
00056 void NetworkClientConnectGame(NetworkAddress address, CompanyID join_as, const char *join_server_password = NULL, const char *join_company_password = NULL);
00057 void NetworkClientRequestMove(CompanyID company, const char *pass = "");
00058 void NetworkClientSendRcon(const char *password, const char *command);
00059 void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg, int64 data = 0);
00060 bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
00061 bool NetworkCompanyIsPassworded(CompanyID company_id);
00062 bool NetworkMaxCompaniesReached();
00063 bool NetworkMaxSpectatorsReached();
00064 void NetworkPrintClients();
00065 void NetworkHandlePauseChange(PauseMode prev_mode, PauseMode changed_mode);
00066
00067
00068 void NetworkServerDailyLoop();
00069 void NetworkServerMonthlyLoop();
00070 void NetworkServerYearlyLoop();
00071 void NetworkServerSendConfigUpdate();
00072 void NetworkServerShowStatusToConsole();
00073 bool NetworkServerStart();
00074 void NetworkServerNewCompany(const Company *company, NetworkClientInfo *ci);
00075 bool NetworkServerChangeClientName(ClientID client_id, const char *new_name);
00076
00077
00078 void NetworkServerDoMove(ClientID client_id, CompanyID company_id);
00079 void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const char *string);
00080 void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, ClientID from_id, int64 data = 0, bool from_admin = false);
00081
00082 void NetworkServerKickClient(ClientID client_id);
00083 uint NetworkServerKickOrBanIP(ClientID client_id, bool ban);
00084 uint NetworkServerKickOrBanIP(const char *ip, bool ban);
00085
00086 void NetworkInitChatMessage();
00087 void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const char *message, ...) WARN_FORMAT(3, 4);
00088 void NetworkUndrawChatMessage();
00089 void NetworkChatMessageLoop();
00090
00091 void NetworkAfterNewGRFScan();
00092
00093 #endif
00094 #endif