| [432] | 1 | // |
|---|
| 2 | // C++ Interface: ClientInformation |
|---|
| 3 | // |
|---|
| 4 | // Description: |
|---|
| 5 | // |
|---|
| 6 | // |
|---|
| 7 | // Author: <>, (C) 2007 |
|---|
| 8 | // |
|---|
| 9 | // Copyright: See COPYING file that comes with this distribution |
|---|
| 10 | // |
|---|
| 11 | // |
|---|
| 12 | #ifndef NETWORKCLIENTINFORMATION_H |
|---|
| 13 | #define NETWORKCLIENTINFORMATION_H |
|---|
| 14 | |
|---|
| [436] | 15 | #include <enet/enet.h> |
|---|
| 16 | |
|---|
| 17 | #define GAMESTATEID_INITIAL -1 |
|---|
| 18 | |
|---|
| [432] | 19 | namespace network { |
|---|
| 20 | |
|---|
| 21 | /** |
|---|
| 22 | * This class implements a list for client informations |
|---|
| 23 | * @author Oliver Scheuss |
|---|
| 24 | */ |
|---|
| 25 | class ClientInformation{ |
|---|
| 26 | public: |
|---|
| 27 | ClientInformation(); |
|---|
| [436] | 28 | ClientInformation(bool head); |
|---|
| [432] | 29 | // ClientInformation(ClientInformation *prev, ClientInformation *next); |
|---|
| 30 | // ClientInformation(ClientInformation *prev); |
|---|
| 31 | ~ClientInformation(); |
|---|
| 32 | ClientInformation *next(); |
|---|
| 33 | ClientInformation *prev(); |
|---|
| [436] | 34 | bool setNext(ClientInformation *next); |
|---|
| 35 | bool setPrev(ClientInformation *prev); |
|---|
| 36 | ClientInformation *insertAfter(ClientInformation *ins); |
|---|
| 37 | ClientInformation *insertBefore(ClientInformation *ins); |
|---|
| 38 | ClientInformation *insertBack(ClientInformation *ins); |
|---|
| 39 | void setID(int clientID); |
|---|
| 40 | void setPeer(ENetPeer *peer); |
|---|
| 41 | void setGamestateID(int id); |
|---|
| 42 | int getID(); |
|---|
| 43 | ENetPeer *getPeer(); |
|---|
| 44 | int getGamestateID(); |
|---|
| 45 | bool removeClient(int clientID); |
|---|
| 46 | bool removeClient(ENetPeer *peer); |
|---|
| 47 | ClientInformation *findClient(int clientID, bool look_backwards=false); |
|---|
| 48 | ClientInformation *findClient(ENetAddress *address, bool look_backwards=false); |
|---|
| 49 | bool head; |
|---|
| [432] | 50 | |
|---|
| 51 | private: |
|---|
| 52 | ClientInformation *preve; |
|---|
| 53 | ClientInformation *nexte; |
|---|
| [436] | 54 | //actual information: |
|---|
| 55 | ENetPeer *peer_; |
|---|
| 56 | int clientID_; |
|---|
| 57 | int gamestateID_; |
|---|
| [432] | 58 | }; |
|---|
| 59 | |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | #endif |
|---|