Changeset 2087 for code/trunk/src/network/ClientInformation.cc
- 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.cc
r1735 r2087 45 45 namespace network 46 46 { 47 47 48 48 ClientInformation *ClientInformation::head_=0; 49 49 50 50 ClientInformation::ClientInformation() { 51 51 if(!head_) … … 59 59 60 60 ClientInformation::~ClientInformation() { 61 if(this==head_)62 head_=next();63 61 if(prev()!=0) 64 62 prev()->setNext(this->next()); 65 63 if(next()!=0) 66 64 next()->setPrev(this->prev()); 65 if(this==head_) 66 head_=next(); 67 67 } 68 68 … … 129 129 return true; 130 130 } 131 131 132 132 bool ClientInformation::setPartialGamestateID(int id){ 133 133 if(!this) … … 137 137 } 138 138 139 int ClientInformation::getID() {139 unsigned int ClientInformation::getID() { 140 140 if(!this) 141 141 return CLIENTID_UNKNOWN; … … 150 150 return NULL; 151 151 } 152 152 153 153 int ClientInformation::getFailures(){ 154 154 return failures_; … … 160 160 failures_=0; 161 161 } 162 162 163 163 enet_uint32 ClientInformation::getRTT(){ 164 return peer_->roundTripTime;165 } 166 167 enet_uint32ClientInformation::getPacketLoss(){168 return peer_->packetLoss;169 } 170 171 int ClientInformation::getGamestateID() {164 return this->peer_->roundTripTime; 165 } 166 167 double ClientInformation::getPacketLoss(){ 168 return ((double)this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE; 169 } 170 171 unsigned int ClientInformation::getGamestateID() { 172 172 if(this) 173 173 return gamestateID_; 174 174 else 175 return -1;176 } 177 178 int ClientInformation::getPartialGamestateID() {175 return (unsigned int)-1; 176 } 177 178 unsigned int ClientInformation::getPartialGamestateID() { 179 179 if(this) 180 180 return partialGamestateID_; 181 181 else 182 return -1;182 return (unsigned int)-1; 183 183 } 184 184 185 185 ClientInformation *ClientInformation::insertBack(ClientInformation *ins) { 186 186 ClientInformation *temp = head_; 187 if(temp== head_){187 if(temp==ins){ 188 188 return head_; 189 189 } … … 196 196 } 197 197 198 bool ClientInformation::removeClient( int clientID) {199 if( clientID==CLIENTID_UNKNOWN)198 bool ClientInformation::removeClient(unsigned int clientID) { 199 if((unsigned int)clientID==CLIENTID_UNKNOWN) 200 200 return false; 201 201 ClientInformation *temp = head_; … … 229 229 * @return pointer to the last element in the list or 0 if the search was unsuccessfull 230 230 */ 231 ClientInformation *ClientInformation::findClient( int clientID, bool look_backwards) {231 ClientInformation *ClientInformation::findClient(unsigned int clientID, bool look_backwards) { 232 232 ClientInformation *temp = head_; 233 233 while(temp!=0 && temp->getID()!=clientID){
Note: See TracChangeset
for help on using the changeset viewer.