network_func.h

Go to the documentation of this file.
00001 /* $Id$ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef NETWORK_FUNC_H
00013 #define NETWORK_FUNC_H
00014 
00015 #include "core/address.h"
00016 #include "network_type.h"
00017 #include "../console_type.h"
00018 #include "../gfx_type.h"
00019 #include "../openttd.h"
00020 #include "../company_type.h"
00021 
00022 #ifdef ENABLE_NETWORK
00023 
00024 extern NetworkServerGameInfo _network_game_info;
00025 extern NetworkCompanyState *_network_company_states;
00026 
00027 extern ClientID _network_own_client_id;
00028 extern ClientID _redirect_console_to_client;
00029 extern bool _network_need_advertise;
00030 extern uint32 _network_last_advertise_frame;
00031 extern uint8 _network_reconnect;
00032 extern StringList _network_bind_list;
00033 extern StringList _network_host_list;
00034 extern StringList _network_ban_list;
00035 
00036 byte NetworkSpectatorCount();
00037 void NetworkUpdateClientName();
00038 bool NetworkCompanyHasClients(CompanyID company);
00039 const char *NetworkChangeCompanyPassword(CompanyID company_id, const char *password, bool already_hashed = true);
00040 void NetworkReboot();
00041 void NetworkDisconnect(bool blocking = false, bool close_admins = true);
00042 void NetworkGameLoop();
00043 void NetworkUDPGameLoop();
00044 void ParseConnectionString(const char **company, const char **port, char *connection_string);
00045 void NetworkStartDebugLog(NetworkAddress address);
00046 void NetworkPopulateCompanyStats(NetworkCompanyStats *stats);
00047 
00048 void NetworkUpdateClientInfo(ClientID client_id);
00049 void NetworkClientsToSpectators(CompanyID cid);
00050 void NetworkClientConnectGame(NetworkAddress address, CompanyID join_as, const char *join_server_password = NULL, const char *join_company_password = NULL);
00051 void NetworkClientRequestMove(CompanyID company, const char *pass = "");
00052 void NetworkClientSendRcon(const char *password, const char *command);
00053 void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg, int64 data = 0);
00054 bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
00055 bool NetworkCompanyIsPassworded(CompanyID company_id);
00056 bool NetworkMaxCompaniesReached();
00057 bool NetworkMaxSpectatorsReached();
00058 void NetworkPrintClients();
00059 void NetworkHandlePauseChange(PauseMode prev_mode, PauseMode changed_mode);
00060 
00061 /*** Commands ran by the server ***/
00062 void NetworkServerDailyLoop();
00063 void NetworkServerMonthlyLoop();
00064 void NetworkServerYearlyLoop();
00065 void NetworkServerSendConfigUpdate();
00066 void NetworkServerShowStatusToConsole();
00067 bool NetworkServerStart();
00068 void NetworkServerUpdateCompanyPassworded(CompanyID company_id, bool passworded);
00069 bool NetworkServerChangeClientName(ClientID client_id, const char *new_name);
00070 
00071 NetworkClientInfo *NetworkFindClientInfoFromClientID(ClientID client_id);
00072 const char *GetClientIP(NetworkClientInfo *ci);
00073 
00074 void NetworkServerDoMove(ClientID client_id, CompanyID company_id);
00075 void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const char *string);
00076 void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, ClientID from_id, int64 data = 0, bool from_admin = false);
00077 
00078 void NetworkServerKickClient(ClientID client_id);
00079 uint NetworkServerKickOrBanIP(const char *ip, bool ban);
00080 
00081 void NetworkInitChatMessage();
00082 void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const char *message, ...) WARN_FORMAT(3, 4);
00083 void NetworkUndrawChatMessage();
00084 void NetworkChatMessageLoop();
00085 
00086 void NetworkAfterNewGRFScan();
00087 
00088 #endif /* ENABLE_NETWORK */
00089 #endif /* NETWORK_FUNC_H */

Generated on Thu Apr 14 00:48:15 2011 for OpenTTD by  doxygen 1.6.1