~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/network/network_base.h

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: network_base.h 14730 2008-12-23 20:52:27Z rubidium $ */
 
2
 
 
3
/** @file network_base.h Base core network types and some helper functions to access them. */
 
4
 
 
5
#ifndef NETWORK_BASE_H
 
6
#define NETWORK_BASE_H
 
7
 
 
8
#ifdef ENABLE_NETWORK
 
9
 
 
10
#include "network_type.h"
 
11
#include "../oldpool.h"
 
12
 
 
13
DECLARE_OLD_POOL(NetworkClientInfo, NetworkClientInfo, NCI_BITS_PER_POOL_BLOCK, MAX_CLIENT_SLOTS >> NCI_BITS_PER_POOL_BLOCK);
 
14
 
 
15
struct NetworkClientInfo : PoolItem<NetworkClientInfo, ClientIndex, &_NetworkClientInfo_pool> {
 
16
        ClientID client_id;                             ///< Client identifier (same as ClientState->client_id)
 
17
        char client_name[NETWORK_CLIENT_NAME_LENGTH];   ///< Name of the client
 
18
        byte client_lang;                               ///< The language of the client
 
19
        CompanyID client_playas;                        ///< As which company is this client playing (CompanyID)
 
20
        uint32 client_ip;                               ///< IP-address of the client (so he can be banned)
 
21
        Date join_date;                                 ///< Gamedate the client has joined
 
22
        char unique_id[NETWORK_UNIQUE_ID_LENGTH];       ///< Every play sends an unique id so we can indentify him
 
23
 
 
24
        NetworkClientInfo(ClientID client_id = INVALID_CLIENT_ID) : client_id(client_id) {}
 
25
        ~NetworkClientInfo() { client_id = INVALID_CLIENT_ID; }
 
26
 
 
27
        inline bool IsValid() const { return client_id != INVALID_CLIENT_ID; }
 
28
};
 
29
 
 
30
static inline bool IsValidNetworkClientInfoIndex(ClientIndex index)
 
31
{
 
32
        return (uint)index < GetNetworkClientInfoPoolSize() && GetNetworkClientInfo(index)->IsValid();
 
33
}
 
34
 
 
35
#define FOR_ALL_CLIENT_INFOS_FROM(d, start) for (d = GetNetworkClientInfo(start); d != NULL; d = (d->index + 1U < GetNetworkClientInfoPoolSize()) ? GetNetworkClientInfo(d->index + 1U) : NULL) if (d->IsValid())
 
36
#define FOR_ALL_CLIENT_INFOS(d) FOR_ALL_CLIENT_INFOS_FROM(d, 0)
 
37
 
 
38
#endif /* ENABLE_NETWORK */
 
39
#endif /* NETWORK_BASE_H */