OpenTTD
network_type.h
Go to the documentation of this file.
1 /* $Id$ */
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_TYPE_H
13 #define NETWORK_TYPE_H
14 
15 #include "core/game.h"
16 
18 static const uint MAX_CLIENTS = 255;
19 
25 static const uint MAX_CLIENT_SLOTS = 256;
26 
31  NETWORK_VEH_TRAIN = 0,
32  NETWORK_VEH_LORRY,
33  NETWORK_VEH_BUS,
34  NETWORK_VEH_PLANE,
35  NETWORK_VEH_SHIP,
36 
37  NETWORK_VEH_END
38 };
39 
41 enum ClientID : uint32 {
45 };
46 
48 typedef uint8 ClientIndex;
49 
51 typedef uint8 AdminIndex;
52 
54 static const AdminIndex MAX_ADMINS = 16;
56 static const AdminIndex INVALID_ADMIN_ID = UINT8_MAX;
57 
60  uint16 num_vehicle[NETWORK_VEH_END];
61  uint16 num_station[NETWORK_VEH_END];
62  bool ai;
63 };
64 
67  char password[NETWORK_PASSWORD_LENGTH];
68  uint16 months_empty;
69 };
70 
71 struct NetworkClientInfo;
72 
77 };
78 
80 enum DestType {
84 };
85 
88  NETWORK_ACTION_JOIN,
89  NETWORK_ACTION_LEAVE,
90  NETWORK_ACTION_SERVER_MESSAGE,
91  NETWORK_ACTION_CHAT,
92  NETWORK_ACTION_CHAT_COMPANY,
93  NETWORK_ACTION_CHAT_CLIENT,
94  NETWORK_ACTION_GIVE_MONEY,
95  NETWORK_ACTION_NAME_CHANGE,
96  NETWORK_ACTION_COMPANY_SPECTATOR,
97  NETWORK_ACTION_COMPANY_JOIN,
98  NETWORK_ACTION_COMPANY_NEW,
99 };
100 
103  NETWORK_ERROR_GENERAL, // Try to use this one like never
104 
105  /* Signals from clients */
106  NETWORK_ERROR_DESYNC,
107  NETWORK_ERROR_SAVEGAME_FAILED,
108  NETWORK_ERROR_CONNECTION_LOST,
109  NETWORK_ERROR_ILLEGAL_PACKET,
110  NETWORK_ERROR_NEWGRF_MISMATCH,
111 
112  /* Signals from servers */
113  NETWORK_ERROR_NOT_AUTHORIZED,
114  NETWORK_ERROR_NOT_EXPECTED,
115  NETWORK_ERROR_WRONG_REVISION,
116  NETWORK_ERROR_NAME_IN_USE,
117  NETWORK_ERROR_WRONG_PASSWORD,
118  NETWORK_ERROR_COMPANY_MISMATCH, // Happens in CLIENT_COMMAND
119  NETWORK_ERROR_KICKED,
120  NETWORK_ERROR_CHEATER,
121  NETWORK_ERROR_FULL,
122  NETWORK_ERROR_TOO_MANY_COMMANDS,
123  NETWORK_ERROR_TIMEOUT_PASSWORD,
124  NETWORK_ERROR_TIMEOUT_COMPUTER,
125  NETWORK_ERROR_TIMEOUT_MAP,
126  NETWORK_ERROR_TIMEOUT_JOIN,
127 
128  NETWORK_ERROR_END,
129 };
130 
131 #endif /* NETWORK_TYPE_H */
Send message/notice to all clients (All)
Definition: network_type.h:81
Container for all information known about a client.
Definition: network_base.h:25
bool ai
Is this company an AI.
Definition: network_type.h:62
NetworkErrorCode
The error codes we send around in the protocols.
Definition: network_type.h:102
static const uint MAX_CLIENTS
How many clients can we have.
Definition: network_type.h:18
static const AdminIndex INVALID_ADMIN_ID
An invalid admin marker.
Definition: network_type.h:56
Send message/notice to only a certain client (Private)
Definition: network_type.h:83
ClientID
&#39;Unique&#39; identifier to be given to clients
Definition: network_type.h:41
The first client ID.
Definition: network_type.h:44
Information about a game that is sent between a game server, game client and masterserver.
The password of the company.
Definition: network_type.h:76
uint16 months_empty
How many months the company is empty.
Definition: network_type.h:68
uint16 num_vehicle[NETWORK_VEH_END]
How many vehicles are there of this type?
Definition: network_type.h:60
static const AdminIndex MAX_ADMINS
Maximum number of allowed admins.
Definition: network_type.h:54
uint8 AdminIndex
Indices into the admin tables.
Definition: network_type.h:51
The password of the game.
Definition: network_type.h:75
NetworkVehicleType
Vehicletypes in the order they are send in info packets.
Definition: network_type.h:30
uint16 num_station[NETWORK_VEH_END]
How many stations are there of this type?
Definition: network_type.h:61
uint8 ClientIndex
Indices into the client tables.
Definition: network_type.h:48
static const uint MAX_CLIENT_SLOTS
The number of slots; must be at least 1 more than MAX_CLIENTS.
Definition: network_type.h:25
Client is not part of anything.
Definition: network_type.h:42
Simple calculated statistics of a company.
Definition: network_type.h:59
static const uint NETWORK_PASSWORD_LENGTH
The maximum length of the password, in bytes including &#39;\0&#39; (must be >= NETWORK_SERVER_ID_LENGTH) ...
Definition: config.h:47
Servers always have this ID.
Definition: network_type.h:43
Some state information of a company, especially for servers.
Definition: network_type.h:66
NetworkPasswordType
The type of password we&#39;re asking for.
Definition: network_type.h:74
Send message/notice to everyone playing the same company (Team)
Definition: network_type.h:82
DestType
Destination of our chat messages.
Definition: network_type.h:80
NetworkAction
Actions that can be used for NetworkTextMessage.
Definition: network_type.h:87