Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 9, 2008, 4:25:52 AM (16 years ago)
Author:
landauf
Message:

merged core3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r1735 r1747  
    5050#include "objects/SpaceShip.h"
    5151#include "core/ConsoleCommand.h"
     52#include "core/Iterator.h"
    5253#include "packet/Chat.h"
    5354#include "packet/Packet.h"
     
    5859  #define MAX_FAILURES 20;
    5960  #define NETWORK_FREQUENCY 30
    60  
     61
    6162  /**
    6263  * Constructor for default values (bindaddress is set to ENET_HOST_ANY
     
    6869    gamestates_ = new GamestateManager();
    6970  }
    70  
     71
    7172  Server::Server(int port){
    7273    timeSinceLastUpdate_=0;
     
    123124    return message->process();
    124125  }
    125  
     126
    126127  /**
    127128  * This function sends out a message to all clients
     
    175176    return;
    176177  }
    177  
     178
    178179  bool Server::queuePacket(ENetPacket *packet, int clientID){
    179180    return connection->addPacket(packet, clientID);
     
    230231    return p->process();
    231232  }
    232  
     233
    233234  /**
    234235  * sends the gamestate
     
    261262      assert(gs->compressData());
    262263      if ( !gs->send() ){
    263         COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl; 
     264        COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->getFailures() << std::endl;
    264265        temp->addFailure();
    265266      }else
     
    276277    return true;
    277278  }
    278  
     279
    279280//   void Server::processChat( chat *data, int clientId){
    280281//     char *message = new char [strlen(data->message)+10+1];
     
    286287//     delete data;
    287288//   }
    288  
     289
    289290  bool Server::addClient(ENetEvent *event){
    290291    ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
     
    303304    return createClient(temp->getID());
    304305  }
    305  
     306
    306307  bool Server::createClient(int clientID){
    307308    ClientInformation *temp = ClientInformation::findClient(clientID);
     
    325326    return true;
    326327  }
    327  
     328
    328329  bool Server::createShip(ClientInformation *client){
    329330    if(!client)
     
    351352    no->create();
    352353    no->setBacksync(true);
    353    
     354
    354355    return true;
    355356  }
    356  
     357
    357358  bool Server::disconnectClient(ENetEvent *event){
    358359    COUT(4) << "removing client from list" << std::endl;
    359360    //return removeClient(head_->findClient(&(peer->address))->getID());
    360    
     361
    361362    //boost::recursive_mutex::scoped_lock lock(head_->mutex_);
    362     orxonox::Iterator<orxonox::SpaceShip> it = orxonox::ObjectList<orxonox::SpaceShip>::start();
     363    orxonox::ObjectList<orxonox::SpaceShip>::iterator it = orxonox::ObjectList<orxonox::SpaceShip>::begin();
    363364    ClientInformation *client = ClientInformation::findClient(&event->peer->address);
    364365    if(!client)
     
    369370        continue;
    370371      }
    371       orxonox::Iterator<orxonox::SpaceShip> temp=it;
     372      orxonox::ObjectList<orxonox::SpaceShip>::iterator temp=it;
    372373      ++it;
    373374      delete  *temp;
     
    386387    gamestates_->removeClient(client);
    387388  }
    388  
     389
    389390}
Note: See TracChangeset for help on using the changeset viewer.