# network_base.h

Go to the documentation of this file.

    00001 /* $Id: network_base.h 18875 2010-01-21 11:17:40Z 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/address.h"
    00019 #include "../core/pool_type.hpp"
    00020 #include "../company_type.h"
    00021
    00022 typedef Pool<NetworkClientInfo, ClientIndex, 8, MAX_CLIENT_SLOTS> NetworkClientInfoPool;
    00023 extern NetworkClientInfoPool _networkclientinfo_pool;
    00024
    00025 struct NetworkClientInfo : NetworkClientInfoPool::PoolItem<&_networkclientinfo_pool> {
    00026   ClientID client_id;
    00027   char client_name[NETWORK_CLIENT_NAME_LENGTH];
    00028   byte client_lang;
    00029   CompanyID client_playas;
    00030   NetworkAddress client_address;
    00031   Date join_date;
    00032
    00033   NetworkClientInfo(ClientID client_id = INVALID_CLIENT_ID) : client_id(client_id) {}
    00034   ~NetworkClientInfo();
    00035 };
    00036
    00037 #define FOR_ALL_CLIENT_INFOS_FROM(var, start) FOR_ALL_ITEMS_FROM(NetworkClientInfo, clientinfo_index, var, start)
    00038 #define FOR_ALL_CLIENT_INFOS(var) FOR_ALL_CLIENT_INFOS_FROM(var, 0)
    00039
    00040 #endif /* ENABLE_NETWORK */
    00041 #endif /* NETWORK_BASE_H */