Changeset 2087 for code/trunk/src/network/ClientInformation.h
- Timestamp:
- Nov 1, 2008, 7:04:09 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/network/ClientInformation.h
r1735 r2087 46 46 #include <boost/thread/recursive_mutex.hpp> 47 47 48 #define GAMESTATEID_INITIAL -149 #define CLIENTID_UNKNOWN -250 51 48 // WATCH OUT: THE CLIENTINFORMATION LIST IS NOT THREADSAFE ANYMORE 52 49 53 50 namespace network 54 51 { 52 static const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1; 53 static const unsigned int CLIENTID_UNKNOWN = (unsigned int)-2; 54 55 55 /** 56 56 * This class implements a list for client informations 57 57 * @author Oliver Scheuss 58 58 */ 59 class ClientInformation{59 class _NetworkExport ClientInformation{ 60 60 public: 61 61 ClientInformation(); … … 66 66 ClientInformation *prev(); 67 67 static ClientInformation *insertBack(ClientInformation *ins); 68 68 69 69 // set functions 70 70 void setID(int clientID); … … 73 73 bool setPartialGamestateID(int id); 74 74 inline void setShipID(unsigned int id){ShipID_=id;} 75 75 76 76 // get functions 77 77 inline unsigned int getShipID(){return ShipID_;} 78 int getID();79 int getGamestateID();80 int getPartialGamestateID();78 unsigned int getID(); 79 unsigned int getGamestateID(); 80 unsigned int getPartialGamestateID(); 81 81 ENetPeer *getPeer(); 82 82 83 83 int getFailures(); 84 84 void addFailure(); 85 85 void resetFailures(); 86 86 enet_uint32 getRTT(); 87 enet_uint32getPacketLoss();88 89 static bool removeClient( int clientID);87 double getPacketLoss(); 88 89 static bool removeClient(unsigned int clientID); 90 90 static bool removeClient(ENetPeer *peer); 91 static ClientInformation *findClient( int clientID, bool look_backwards=false);91 static ClientInformation *findClient(unsigned int clientID, bool look_backwards=false); 92 92 static ClientInformation *findClient(ENetAddress *address, bool look_backwards=false); 93 93 static ClientInformation *getBegin(){return head_;} … … 99 99 private: 100 100 static ClientInformation *head_; 101 101 102 102 bool setNext(ClientInformation *next); 103 103 bool setPrev(ClientInformation *prev); 104 104 ClientInformation *insertAfter(ClientInformation *ins); 105 105 ClientInformation *insertBefore(ClientInformation *ins); 106 106 107 107 ClientInformation *preve; 108 108 ClientInformation *nexte; 109 109 //actual information: 110 110 ENetPeer *peer_; 111 int clientID_;112 int gamestateID_;113 int partialGamestateID_;111 unsigned int clientID_; 112 unsigned int gamestateID_; 113 unsigned int partialGamestateID_; 114 114 unsigned int ShipID_; // this is the unique objectID 115 115 bool synched_; 116 116 unsigned short failures_; 117 117 118 118 }; 119 119
Note: See TracChangeset
for help on using the changeset viewer.