[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> |
---|
[444] | 16 | #include <iostream> //debug |
---|
[436] | 17 | |
---|
| 18 | #define GAMESTATEID_INITIAL -1 |
---|
| 19 | |
---|
[432] | 20 | namespace network { |
---|
| 21 | |
---|
| 22 | /** |
---|
| 23 | * This class implements a list for client informations |
---|
| 24 | * @author Oliver Scheuss |
---|
| 25 | */ |
---|
| 26 | class ClientInformation{ |
---|
| 27 | public: |
---|
| 28 | ClientInformation(); |
---|
[436] | 29 | ClientInformation(bool head); |
---|
[432] | 30 | // ClientInformation(ClientInformation *prev, ClientInformation *next); |
---|
| 31 | // ClientInformation(ClientInformation *prev); |
---|
| 32 | ~ClientInformation(); |
---|
| 33 | ClientInformation *next(); |
---|
| 34 | ClientInformation *prev(); |
---|
[436] | 35 | bool setNext(ClientInformation *next); |
---|
| 36 | bool setPrev(ClientInformation *prev); |
---|
| 37 | ClientInformation *insertAfter(ClientInformation *ins); |
---|
| 38 | ClientInformation *insertBefore(ClientInformation *ins); |
---|
| 39 | ClientInformation *insertBack(ClientInformation *ins); |
---|
| 40 | void setID(int clientID); |
---|
| 41 | void setPeer(ENetPeer *peer); |
---|
| 42 | void setGamestateID(int id); |
---|
| 43 | int getID(); |
---|
| 44 | ENetPeer *getPeer(); |
---|
| 45 | int getGamestateID(); |
---|
| 46 | bool removeClient(int clientID); |
---|
| 47 | bool removeClient(ENetPeer *peer); |
---|
| 48 | ClientInformation *findClient(int clientID, bool look_backwards=false); |
---|
| 49 | ClientInformation *findClient(ENetAddress *address, bool look_backwards=false); |
---|
[636] | 50 | |
---|
| 51 | void setSynched(bool s); |
---|
| 52 | bool getSynched(); |
---|
| 53 | |
---|
[436] | 54 | bool head; |
---|
[432] | 55 | |
---|
| 56 | private: |
---|
| 57 | ClientInformation *preve; |
---|
| 58 | ClientInformation *nexte; |
---|
[436] | 59 | //actual information: |
---|
| 60 | ENetPeer *peer_; |
---|
| 61 | int clientID_; |
---|
| 62 | int gamestateID_; |
---|
[636] | 63 | bool synched_; |
---|
[432] | 64 | }; |
---|
| 65 | |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | #endif |
---|