Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/network/ClientInformation.h @ 7940

Last change on this file since 7940 was 7801, checked in by dafrick, 14 years ago

Merging presentation2 branch back to trunk.

  • Property svn:eol-style set to native
File size: 3.1 KB
RevLine 
[1505]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      ...
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29//
30// C++ Interface: ClientInformation
31//
32// Description:
33//
34//
35// Author:  <>, (C) 2007
36//
37// Copyright: See COPYING file that comes with this distribution
38//
39//
40#ifndef _ClientInformation_H__
41#define _ClientInformation_H__
42
43#include "NetworkPrereqs.h"
44
45// WATCH OUT: THE CLIENTINFORMATION LIST IS NOT THREADSAFE ANYMORE
46
[2171]47namespace orxonox
[1505]48{
[2087]49
[1505]50  /**
[5695]51  * This class implements a list for client information
[1505]52  * @author Oliver Scheuss
53  */
[2087]54  class _NetworkExport ClientInformation{
[1505]55  public:
56    ClientInformation();
57    //   ClientInformation(ClientInformation *prev, ClientInformation *next);
58    //   ClientInformation(ClientInformation *prev);
59    ~ClientInformation();
60    ClientInformation *next();
61    ClientInformation *prev();
[1735]62    static ClientInformation *insertBack(ClientInformation *ins);
[2087]63
[1505]64    // set functions
65    void setID(int clientID);
66    bool setPeer(ENetPeer *peer);
[1735]67    bool setGamestateID(int id);
68    inline void setShipID(unsigned int id){ShipID_=id;}
[2087]69
[1505]70    // get functions
[1735]71    inline unsigned int getShipID(){return ShipID_;}
[2087]72    unsigned int getID();
73    unsigned int getGamestateID();
[1505]74    ENetPeer *getPeer();
[2087]75
[2773]76    uint32_t getRTT();
[2087]77    double getPacketLoss();
78
79    static bool removeClient(unsigned int clientID);
[1735]80    static bool removeClient(ENetPeer *peer);
[2087]81    static ClientInformation *findClient(unsigned int clientID, bool look_backwards=false);
[1735]82    static ClientInformation *findClient(ENetAddress *address, bool look_backwards=false);
83    static ClientInformation *getBegin(){return head_;}
[3304]84    static bool hasClients(){ return ClientInformation::head_!=0; }
[1505]85
86    bool setSynched(bool s);
87    bool getSynched();
88
[1735]89  private:
90    static ClientInformation *head_;
[2087]91
[1735]92    bool setNext(ClientInformation *next);
93    bool setPrev(ClientInformation *prev);
[1505]94    ClientInformation *insertAfter(ClientInformation *ins);
95    ClientInformation *insertBefore(ClientInformation *ins);
[2087]96
[1505]97    ClientInformation *preve;
98    ClientInformation *nexte;
99    //actual information:
100    ENetPeer *peer_;
[2087]101    unsigned int clientID_;
102    unsigned int gamestateID_;
[1735]103    unsigned int ShipID_;   // this is the unique objectID
[1505]104    bool synched_;
[2087]105
[1505]106  };
107
108}
109
110#endif /* _ClientInformation_H__ */
Note: See TracBrowser for help on using the repository browser.