# network_base.h

Go to the documentation of this file.

    00001 /* $Id$ */
    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
    00023 typedef Pool<NetworkClientInfo, ClientIndex, 8, MAX_CLIENT_SLOTS, PT_NCLIENT> NetworkClientInfoPool;
    00024 extern NetworkClientInfoPool _networkclientinfo_pool;
    00025
    00027 struct NetworkClientInfo : NetworkClientInfoPool::PoolItem<&_networkclientinfo_pool> {
    00028   ClientID client_id;
    00029   char client_name[NETWORK_CLIENT_NAME_LENGTH];
    00030   byte client_lang;
    00031   CompanyID client_playas;
    00032   Date join_date;
    00033
    00038   NetworkClientInfo(ClientID client_id = INVALID_CLIENT_ID) : client_id(client_id) {}
    00039   ~NetworkClientInfo();
    00040
    00041   static NetworkClientInfo *GetByClientID(ClientID client_id);
    00042 };
    00043
    00049 #define FOR_ALL_CLIENT_INFOS_FROM(var, start) FOR_ALL_ITEMS_FROM(NetworkClientInfo, clientinfo_index, var, start)
    00050
    00055 #define FOR_ALL_CLIENT_INFOS(var) FOR_ALL_CLIENT_INFOS_FROM(var, 0)
    00056
    00057 #endif /* ENABLE_NETWORK */
    00058 #endif /* NETWORK_BASE_H */