2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 /** @file network_base.h Base core network types and some helper functions to access them. */
10 #ifndef NETWORK_BASE_H
11 #define NETWORK_BASE_H
13 #include "network_type.h"
14 #include "core/address.h"
15 #include "../core/pool_type.hpp"
16 #include "../company_type.h"
17 #include "../date_type.h"
19 /** Type for the pool with client information. */
20 typedef Pool
<NetworkClientInfo
, ClientIndex
, 8, MAX_CLIENT_SLOTS
, PT_NCLIENT
> NetworkClientInfoPool
;
21 extern NetworkClientInfoPool _networkclientinfo_pool
;
23 /** Container for all information known about a client. */
24 struct NetworkClientInfo
: NetworkClientInfoPool::PoolItem
<&_networkclientinfo_pool
> {
25 ClientID client_id
; ///< Client identifier (same as ClientState->client_id)
26 std::string client_name
; ///< Name of the client
27 CompanyID client_playas
; ///< As which company is this client playing (CompanyID)
28 Date join_date
; ///< Gamedate the client has joined
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
) {}
37 static NetworkClientInfo
*GetByClientID(ClientID client_id
);
40 #endif /* NETWORK_BASE_H */