Make it possible to stop road vehicles from slowing down in curves so "diagonal"...
[openttd-joker.git] / src / network / network_base.h
blob6bade417b191cb7023efce6b75e3659f67b3c32a
1 /* $Id: network_base.h 22423 2011-05-04 20:24:23Z rubidium $ */
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 /** Type for the pool with client information. */
23 typedef Pool<NetworkClientInfo, ClientIndex, 8, MAX_CLIENT_SLOTS, PT_NCLIENT> NetworkClientInfoPool;
24 extern NetworkClientInfoPool _networkclientinfo_pool;
26 /** Container for all information known about a client. */
27 struct NetworkClientInfo : NetworkClientInfoPool::PoolItem<&_networkclientinfo_pool> {
28 ClientID client_id; ///< Client identifier (same as ClientState->client_id)
29 char client_name[NETWORK_CLIENT_NAME_LENGTH]; ///< Name of the client
30 byte client_lang; ///< The language of the client
31 CompanyID client_playas; ///< As which company is this client playing (CompanyID)
32 Date join_date; ///< Gamedate the client has joined
34 /**
35 * Create a new client.
36 * @param client_id The unique identifier of the client.
38 NetworkClientInfo(ClientID client_id = INVALID_CLIENT_ID) : client_id(client_id) {}
39 ~NetworkClientInfo();
41 static NetworkClientInfo *GetByClientID(ClientID client_id);
44 /**
45 * Iterate over all the clients from a given index.
46 * @param var The variable to iterate with.
47 * @param start The location to start the iteration from.
49 #define FOR_ALL_CLIENT_INFOS_FROM(var, start) FOR_ALL_ITEMS_FROM(NetworkClientInfo, clientinfo_index, var, start)
51 /**
52 * Iterate over all the clients.
53 * @param var The variable to iterate with.
55 #define FOR_ALL_CLIENT_INFOS(var) FOR_ALL_CLIENT_INFOS_FROM(var, 0)
57 #endif /* ENABLE_NETWORK */
58 #endif /* NETWORK_BASE_H */