Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2008, 3:54:20 PM (16 years ago)
Author:
rgrieder
Message:
  • @everyone: Do not create a branch until I've added the svn:eol-style property correctly. Otherwise this would cost me another 4 hours or so when we want to merge back.
  • merged network branch back to trunk
  • I had to omit the changes from last evening concerning the line endings
  • might not work yet because of the line endings
  • @beni: script branch is the only branch still open. you probably will have to apply a patch because of inconsistent new lines
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/network/ClientInformation.cc

    r1360 r1502  
    4545namespace network
    4646{
    47   boost::recursive_mutex ClientInformation::mutex_;
    4847 
    4948  ClientInformation::ClientInformation() {
     
    8483
    8584  ClientInformation::~ClientInformation() {
    86     boost::recursive_mutex::scoped_lock lock(mutex_);
    87     if(preve!=0)
    88       preve->setNext(this->nexte);
    89     if(nexte!=0)
    90       nexte->setPrev(this->preve);
     85    if(prev()!=0)
     86      prev()->setNext(this->next());
     87    if(next()!=0)
     88      next()->setPrev(this->prev());
    9189  }
    9290
    9391  ClientInformation *ClientInformation::next() {
    94     boost::recursive_mutex::scoped_lock lock(mutex_);
    9592    if(this!=0)
    9693      return this->nexte;
     
    9996  }
    10097  ClientInformation *ClientInformation::prev() {
    101     boost::recursive_mutex::scoped_lock lock(mutex_);
    10298    if(this!=0)
    10399      return this->preve;
     
    107103
    108104  bool ClientInformation::setPrev(ClientInformation *prev) {
    109     boost::recursive_mutex::scoped_lock lock(mutex_);
    110105    if(!head_)
    111106      this->preve = prev;
     
    116111
    117112  bool ClientInformation::setNext(ClientInformation *next) {
    118     boost::recursive_mutex::scoped_lock lock(mutex_);
    119113    this->nexte = next;
    120114    return true;
     
    122116
    123117  ClientInformation *ClientInformation::insertAfter(ClientInformation *ins) {
    124     boost::recursive_mutex::scoped_lock lock(mutex_);
    125     this->nexte->setPrev(ins);
    126     ins->setNext(this->nexte);
     118    this->next()->setPrev(ins);
     119    ins->setNext(this->next());
    127120    ins->setPrev(this);
    128121    this->nexte = ins;
     
    131124
    132125  ClientInformation *ClientInformation::insertBefore(ClientInformation *ins){
    133     boost::recursive_mutex::scoped_lock lock(mutex_);
    134126    if(!this)
    135127      return NULL;
    136128    this->prev()->setNext(ins);
    137     ins->setPrev(this->preve);
     129    ins->setPrev(this->prev());
    138130    this->preve=ins;
    139131    ins->setNext(this);
     
    142134
    143135  void ClientInformation::setID(int clientID){
    144     boost::recursive_mutex::scoped_lock lock(mutex_);
     136    if(!this)
     137      return;
    145138    clientID_ = clientID;
    146139  }
    147140
    148141  bool ClientInformation::setPeer(ENetPeer *peer){
    149     boost::recursive_mutex::scoped_lock lock(mutex_);
    150142    if(!this)
    151143      return false;
     
    154146  }
    155147
    156   bool ClientInformation::setGamestateID(int id){
    157     boost::recursive_mutex::scoped_lock lock(mutex_);
     148  bool ClientInformation::setGameStateID(int id){
    158149    if(!this)
    159150      return false;
     
    163154 
    164155  bool ClientInformation::setPartialGamestateID(int id){
    165     boost::recursive_mutex::scoped_lock lock(mutex_);
    166156    if(!this)
    167157      return false;
     
    171161
    172162  int ClientInformation::getID() {
    173     boost::recursive_mutex::scoped_lock lock(mutex_);
    174163    if(!this)
    175164      return CLIENTID_UNKNOWN;
     
    179168
    180169  ENetPeer *ClientInformation::getPeer() {
    181     boost::recursive_mutex::scoped_lock lock(mutex_);
    182170    if(this)
    183171      return peer_;
     
    187175 
    188176  bool ClientInformation::getHead(){
    189     boost::recursive_mutex::scoped_lock lock(mutex_);
    190177    return head_;
    191178  }
    192179 
    193180  void ClientInformation::setHead(bool h){
    194     boost::recursive_mutex::scoped_lock lock(mutex_);
    195181    head_=h;
    196182  }
    197183 
    198184  int ClientInformation::getFailures(){
    199     boost::recursive_mutex::scoped_lock lock(mutex_);
    200185    return failures_;
    201186  }
    202187  void ClientInformation::addFailure(){
    203     boost::recursive_mutex::scoped_lock lock(mutex_);
    204188    failures_++;
    205189  }
    206190  void ClientInformation::resetFailures(){
    207     boost::recursive_mutex::scoped_lock lock(mutex_);
    208191    failures_=0;
    209192  }
    210193
    211194  int ClientInformation::getGamestateID() {
    212     boost::recursive_mutex::scoped_lock lock(mutex_);
    213195    if(this)
    214196      return gamestateID_;
     
    218200 
    219201  int ClientInformation::getPartialGamestateID() {
    220     boost::recursive_mutex::scoped_lock lock(mutex_);
    221202    if(this)
    222203      return partialGamestateID_;
     
    226207
    227208  ClientInformation *ClientInformation::insertBack(ClientInformation *ins) {
    228     boost::recursive_mutex::scoped_lock lock(mutex_);
    229209    if(!this)
    230210      return NULL;
     
    239219
    240220  bool ClientInformation::removeClient(int clientID) {
    241     boost::recursive_mutex::scoped_lock lock(mutex_);
    242221    if(!this || clientID==CLIENTID_UNKNOWN)
    243222      return false;
     
    252231
    253232  bool ClientInformation::removeClient(ENetPeer *peer) {
    254     boost::recursive_mutex::scoped_lock lock(mutex_);
    255233    if(!this || !peer)
    256234      return false;
     
    275253  */
    276254  ClientInformation *ClientInformation::findClient(int clientID, bool look_backwards) {
    277     boost::recursive_mutex::scoped_lock lock(mutex_);
    278255    ClientInformation *temp = this;
    279256    if (temp->head_)
     
    293270  */
    294271  ClientInformation *ClientInformation::findClient(ENetAddress *address, bool look_backwards) {
    295     boost::recursive_mutex::scoped_lock lock(mutex_);
    296272    ClientInformation *temp = this;
    297273    while(temp!=0){
     
    309285
    310286  bool ClientInformation::setSynched(bool s) {
    311     boost::recursive_mutex::scoped_lock lock(mutex_);
    312287    if(!this)
    313288      return false;
     
    317292
    318293  bool ClientInformation::getSynched() {
    319     boost::recursive_mutex::scoped_lock lock(mutex_);
    320294    if(this)
    321295      return synched_;
Note: See TracChangeset for help on using the changeset viewer.