network_base.h

Go to the documentation of this file.
00001 /* $Id: network_base.h 17737 2009-10-07 17:36:33Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * 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.
00006  * 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.
00007  * 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/>.
00008  */
00009 
00012 #ifndef NETWORK_BASE_H
00013 #define NETWORK_BASE_H
00014 
00015 #ifdef ENABLE_NETWORK
00016 
00017 #include "network_type.h"
00018 #include "../core/pool_type.hpp"
00019 
00020 typedef Pool<NetworkClientInfo, ClientIndex, 8, MAX_CLIENT_SLOTS> NetworkClientInfoPool;
00021 extern NetworkClientInfoPool _networkclientinfo_pool;
00022 
00023 struct NetworkClientInfo : NetworkClientInfoPool::PoolItem<&_networkclientinfo_pool> {
00024   ClientID client_id;                             
00025   char client_name[NETWORK_CLIENT_NAME_LENGTH];   
00026   byte client_lang;                               
00027   CompanyID client_playas;                        
00028   NetworkAddress client_address;                  
00029   Date join_date;                                 
00030   char unique_id[NETWORK_UNIQUE_ID_LENGTH];       
00031 
00032   NetworkClientInfo(ClientID client_id = INVALID_CLIENT_ID) : client_id(client_id) {}
00033   ~NetworkClientInfo();
00034 };
00035 
00036 #define FOR_ALL_CLIENT_INFOS_FROM(var, start) FOR_ALL_ITEMS_FROM(NetworkClientInfo, clientinfo_index, var, start)
00037 #define FOR_ALL_CLIENT_INFOS(var) FOR_ALL_CLIENT_INFOS_FROM(var, 0)
00038 
00039 #endif /* ENABLE_NETWORK */
00040 #endif /* NETWORK_BASE_H */

Generated on Tue Jan 5 21:02:55 2010 for OpenTTD by  doxygen 1.5.6