[1056] | 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 | |
---|
[432] | 29 | // |
---|
| 30 | // C++ Interface: ClientInformation |
---|
| 31 | // |
---|
[1056] | 32 | // Description: |
---|
[432] | 33 | // |
---|
| 34 | // |
---|
| 35 | // Author: <>, (C) 2007 |
---|
| 36 | // |
---|
| 37 | // Copyright: See COPYING file that comes with this distribution |
---|
| 38 | // |
---|
| 39 | // |
---|
[673] | 40 | #ifndef _ClientInformation_H__ |
---|
| 41 | #define _ClientInformation_H__ |
---|
[432] | 42 | |
---|
[1062] | 43 | #include "NetworkPrereqs.h" |
---|
| 44 | |
---|
[436] | 45 | #include <enet/enet.h> |
---|
| 46 | |
---|
| 47 | #define GAMESTATEID_INITIAL -1 |
---|
| 48 | |
---|
[777] | 49 | namespace network |
---|
| 50 | { |
---|
| 51 | /** |
---|
| 52 | * This class implements a list for client informations |
---|
| 53 | * @author Oliver Scheuss |
---|
| 54 | */ |
---|
| 55 | class ClientInformation{ |
---|
| 56 | public: |
---|
| 57 | ClientInformation(); |
---|
| 58 | ClientInformation(bool head); |
---|
| 59 | // ClientInformation(ClientInformation *prev, ClientInformation *next); |
---|
| 60 | // ClientInformation(ClientInformation *prev); |
---|
| 61 | ~ClientInformation(); |
---|
| 62 | ClientInformation *next(); |
---|
| 63 | ClientInformation *prev(); |
---|
| 64 | bool setNext(ClientInformation *next); |
---|
| 65 | bool setPrev(ClientInformation *prev); |
---|
| 66 | ClientInformation *insertAfter(ClientInformation *ins); |
---|
| 67 | ClientInformation *insertBefore(ClientInformation *ins); |
---|
| 68 | ClientInformation *insertBack(ClientInformation *ins); |
---|
| 69 | void setID(int clientID); |
---|
| 70 | void setPeer(ENetPeer *peer); |
---|
| 71 | void setGamestateID(int id); |
---|
| 72 | int getID(); |
---|
| 73 | ENetPeer *getPeer(); |
---|
| 74 | int getGamestateID(); |
---|
| 75 | bool removeClient(int clientID); |
---|
| 76 | bool removeClient(ENetPeer *peer); |
---|
[1098] | 77 | //## add bool mask-function eventually |
---|
[777] | 78 | ClientInformation *findClient(int clientID, bool look_backwards=false); |
---|
[1098] | 79 | //## add bool mask-function eventually |
---|
[777] | 80 | ClientInformation *findClient(ENetAddress *address, bool look_backwards=false); |
---|
[432] | 81 | |
---|
[777] | 82 | void setSynched(bool s); |
---|
| 83 | bool getSynched(); |
---|
[432] | 84 | |
---|
[777] | 85 | bool head; |
---|
| 86 | |
---|
| 87 | private: |
---|
| 88 | ClientInformation *preve; |
---|
| 89 | ClientInformation *nexte; |
---|
| 90 | //actual information: |
---|
| 91 | ENetPeer *peer_; |
---|
| 92 | int clientID_; |
---|
| 93 | int gamestateID_; |
---|
| 94 | bool synched_; |
---|
| 95 | }; |
---|
| 96 | |
---|
[432] | 97 | } |
---|
| 98 | |
---|
[673] | 99 | #endif /* _ClientInformation_H__ */ |
---|