OpenTTD
network_client.h
Go to the documentation of this file.
1 /* $Id: network_client.h 24900 2013-01-08 22:46:42Z planetmaker $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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/>.
8  */
9 
12 #ifndef NETWORK_CLIENT_H
13 #define NETWORK_CLIENT_H
14 
15 #ifdef ENABLE_NETWORK
16 
17 #include "network_internal.h"
18 
21 private:
23  byte token;
24 
26  enum ServerStatus {
38  };
39 
41 
42 protected:
43  friend void NetworkExecuteLocalCommandQueue();
44  friend void NetworkClose(bool close_admins);
46 
74 
78  void CheckConnection();
79 public:
82 
85 
87 
88  static NetworkRecvStatus SendJoin();
91  static NetworkRecvStatus SendQuit();
92  static NetworkRecvStatus SendAck();
93 
94  static NetworkRecvStatus SendGamePassword(const char *password);
95  static NetworkRecvStatus SendCompanyPassword(const char *password);
96 
97  static NetworkRecvStatus SendChat(NetworkAction action, DestType type, int dest, const char *msg, int64 data);
98  static NetworkRecvStatus SendSetPassword(const char *password);
99  static NetworkRecvStatus SendSetName(const char *name);
100  static NetworkRecvStatus SendRCon(const char *password, const char *command);
101  static NetworkRecvStatus SendMove(CompanyID company, const char *password);
102 
103  static bool IsConnected();
104 
105  static void Send();
106  static bool Receive();
107  static bool GameLoop();
108 };
109 
112 
114 void NetworkClientSetCompanyPassword(const char *password);
115 
117 
118 extern const char *_network_join_server_password;
119 extern const char *_network_join_company_password;
120 
121 #endif /* ENABLE_NETWORK */
122 
123 #endif /* NETWORK_CLIENT_H */