Translations update
[openttd/fttd.git] / src / network / network_base.h
blob5477304416a61d93e12c2e8555b20a2b119cc1a6
1 /* $Id$ */
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 */
10 /** @file network_base.h Base core network types and some helper functions to access them. */
12 #ifndef NETWORK_BASE_H
13 #define NETWORK_BASE_H
15 #ifdef ENABLE_NETWORK
17 #include "network_type.h"
18 #include "core/address.h"
19 #include "../core/pool_type.hpp"
20 #include "../company_type.h"
22 /** Container for all information known about a client. */
23 struct NetworkClientInfo : PooledItem <NetworkClientInfo, ClientIndex, 8, MAX_CLIENT_SLOTS, PT_NCLIENT> {
24 ClientID client_id; ///< Client identifier (same as ClientState->client_id)
25 char client_name[NETWORK_CLIENT_NAME_LENGTH]; ///< Name of the client
26 byte client_lang; ///< The language of the client
27 CompanyID client_playas; ///< As which company is this client playing (CompanyID)
28 Date join_date; ///< Gamedate the client has joined
30 /**
31 * Create a new client.
32 * @param client_id The unique identifier of the client.
34 NetworkClientInfo(ClientID client_id = INVALID_CLIENT_ID) : client_id(client_id) {}
35 ~NetworkClientInfo();
37 static NetworkClientInfo *GetByClientID(ClientID client_id);
40 /**
41 * Iterate over all the clients from a given index.
42 * @param var The variable to iterate with.
43 * @param start The location to start the iteration from.
45 #define FOR_ALL_CLIENT_INFOS_FROM(var, start) FOR_ALL_ITEMS_FROM(NetworkClientInfo, clientinfo_index, var, start)
47 /**
48 * Iterate over all the clients.
49 * @param var The variable to iterate with.
51 #define FOR_ALL_CLIENT_INFOS(var) FOR_ALL_CLIENT_INFOS_FROM(var, 0)
53 #endif /* ENABLE_NETWORK */
54 #endif /* NETWORK_BASE_H */