Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2008, 7:04:09 PM (16 years ago)
Author:
landauf
Message:

merged objecthierarchy branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/network/ClientInformation.cc

    r1735 r2087  
    4545namespace network
    4646{
    47  
     47
    4848  ClientInformation *ClientInformation::head_=0;
    49  
     49
    5050  ClientInformation::ClientInformation() {
    5151    if(!head_)
     
    5959
    6060  ClientInformation::~ClientInformation() {
    61     if(this==head_)
    62       head_=next();
    6361    if(prev()!=0)
    6462      prev()->setNext(this->next());
    6563    if(next()!=0)
    6664      next()->setPrev(this->prev());
     65    if(this==head_)
     66      head_=next();
    6767  }
    6868
     
    129129    return true;
    130130  }
    131  
     131
    132132  bool ClientInformation::setPartialGamestateID(int id){
    133133    if(!this)
     
    137137  }
    138138
    139   int ClientInformation::getID() {
     139  unsigned int ClientInformation::getID() {
    140140    if(!this)
    141141      return CLIENTID_UNKNOWN;
     
    150150      return NULL;
    151151  }
    152  
     152
    153153  int ClientInformation::getFailures(){
    154154    return failures_;
     
    160160    failures_=0;
    161161  }
    162  
     162
    163163  enet_uint32 ClientInformation::getRTT(){
    164     return peer_->roundTripTime;
    165   }
    166  
    167   enet_uint32 ClientInformation::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() {
    172172    if(this)
    173173      return gamestateID_;
    174174    else
    175       return -1;
    176   }
    177  
    178   int ClientInformation::getPartialGamestateID() {
     175      return (unsigned int)-1;
     176  }
     177
     178  unsigned int ClientInformation::getPartialGamestateID() {
    179179    if(this)
    180180      return partialGamestateID_;
    181181    else
    182       return -1;
     182      return (unsigned int)-1;
    183183  }
    184184
    185185  ClientInformation *ClientInformation::insertBack(ClientInformation *ins) {
    186186    ClientInformation *temp = head_;
    187     if(temp==head_){
     187    if(temp==ins){
    188188      return head_;
    189189    }
     
    196196  }
    197197
    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)
    200200      return false;
    201201    ClientInformation *temp = head_;
     
    229229  * @return pointer to the last element in the list or 0 if the search was unsuccessfull
    230230  */
    231   ClientInformation *ClientInformation::findClient(int clientID, bool look_backwards) {
     231  ClientInformation *ClientInformation::findClient(unsigned int clientID, bool look_backwards) {
    232232    ClientInformation *temp = head_;
    233233    while(temp!=0 && temp->getID()!=clientID){
Note: See TracChangeset for help on using the changeset viewer.