Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7823


Ignore:
Timestamp:
Dec 28, 2010, 4:46:42 PM (13 years ago)
Author:
scheusso
Message:

again some structural changes in network to increase modularity/encapsulation
precondition for fixing client-disconnect bug

Location:
code/branches/network6/src
Files:
4 deleted
29 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network6/src/libraries/network/CMakeLists.txt

    r7801 r7823  
    2222  Client.cc
    2323  ClientConnection.cc
    24   ClientInformation.cc
    2524  ClientConnectionListener.cc
    2625  Connection.cc
     
    5049  ClientConnection.h
    5150  ClientConnectionListener.h
    52   ClientInformation.h
    5351  Connection.h
    5452  FunctionCall.h
  • code/branches/network6/src/libraries/network/ClientConnection.cc

    r7801 r7823  
    103103      if( enet_host_service(this->host_, &event, NETWORK_CLIENT_WAIT_TIME)>=0 && event.type == ENET_EVENT_TYPE_CONNECT )
    104104      {
     105        // manually add server to list of peers
     106        /*incomingEvent inEvent = */Connection::preprocessConnectEvent(event);
     107//         addPeer(inEvent.peerID);
     108        // start communication thread
    105109        this->established_=true;
    106110        Connection::startCommunicationThread();
     
    148152    assert( this->server_ );
    149153    assert( packet );
    150     return Connection::addPacket( packet, this->server_, channelID );
     154//     return Connection::addPacket( packet, NETWORK_PEER_ID_SERVER, channelID );
     155    // HACK: actually there should be a way to do this using addPacket and the correct peerID
     156    return Connection::broadcastPacket(packet, channelID);
    151157  }
    152158
    153   void ClientConnection::addPeer(ENetEvent* event)
     159  void ClientConnection::addPeer(uint32_t peerID)
    154160  {
    155161    assert(0);
    156162  }
    157   void ClientConnection::removePeer(ENetEvent* event)
     163  void ClientConnection::removePeer(uint32_t peerID)
    158164  {
    159165    this->established_=false;
  • code/branches/network6/src/libraries/network/ClientConnection.h

    r7801 r7823  
    5757    uint32_t getRTT();
    5858  private:
    59     virtual void addPeer(ENetEvent* event);
    60     virtual void removePeer(ENetEvent* event);
     59    virtual void addPeer(uint32_t peerID);
     60    virtual void removePeer(uint32_t peerID);
    6161
    6262    bool disconnectConnection();
  • code/branches/network6/src/libraries/network/ClientConnectionListener.cc

    r6417 r7823  
    3131#include "core/CoreIncludes.h"
    3232#include "core/GameMode.h"
    33 #include "ClientInformation.h"
     33// #include "ClientInformation.h"
    3434
    3535namespace orxonox
     
    5252    }
    5353
    54     void ClientConnectionListener::getConnectedClients()
    55     {
    56         ClientInformation* client = ClientInformation::getBegin();
    57         while (client)
    58         {
    59             this->clientConnected(client->getID());
    60             client = client->next();
    61         }
    62     }
     54//     void ClientConnectionListener::getConnectedClients()
     55//     {
     56//         ClientInformation* client = ClientInformation::getBegin();
     57//         while (client)
     58//         {
     59//             this->clientConnected(client->getID());
     60//             client = client->next();
     61//         }
     62//     }
    6363}
    6464
  • code/branches/network6/src/libraries/network/ClientConnectionListener.h

    r6417 r7823  
    4848
    4949        protected:
    50             void getConnectedClients();
     50//             void getConnectedClients();
    5151    };
    5252}
  • code/branches/network6/src/libraries/network/Connection.cc

    r7801 r7823  
    4444
    4545  Connection::Connection():
    46     host_(0), bCommunicationThreadRunning_(false)
     46    host_(0), bCommunicationThreadRunning_(false), nextPeerID_(NETWORK_PEER_ID_SERVER+1)
    4747  {
    4848    enet_initialize();
     
    7575  }
    7676
    77 
    78 //   int Connection::service(ENetEvent* event) {
    79 //     return enet_host_service( this->host_, event, NETWORK_WAIT_TIMEOUT );
    80 //   }
    81 
    82   void Connection::disconnectPeer(ENetPeer *peer)
    83   {
    84     assert(peer);
    85     outgoingEvent outEvent = { peer, outgoingEventType::disconnectPeer, (ENetPacket*)10, 15 };
     77  void Connection::disconnectPeer(uint32_t peerID)
     78  {
     79    outgoingEvent outEvent = { peerID, outgoingEventType::disconnectPeer, 0, 0 };
    8680   
    8781    this->outgoingEventsMutex_->lock();
     
    8983    this->outgoingEventsMutex_->unlock();
    9084  }
    91 
    92   void Connection::addPacket(ENetPacket *packet, ENetPeer *peer, uint8_t channelID)
    93   {
    94     assert(peer);
    95     outgoingEvent outEvent = { peer, outgoingEventType::sendPacket, packet, channelID };
     85 
     86  void Connection::disconnectPeers()
     87  {
     88    outgoingEvent outEvent = { 0, outgoingEventType::disconnectPeers, 0, 0 };
    9689   
    9790    this->outgoingEventsMutex_->lock();
     
    9992    this->outgoingEventsMutex_->unlock();
    10093  }
    101  
    102   void Connection::broadcastPacket(ENetPacket* packet, uint8_t channelID)
    103   {
    104     outgoingEvent outEvent = { (ENetPeer*)15, outgoingEventType::broadcastPacket, packet, channelID };
     94
     95  void Connection::addPacket(ENetPacket* packet, uint32_t peerID, uint8_t channelID)
     96  {
     97    outgoingEvent outEvent = { peerID, outgoingEventType::sendPacket, packet, channelID };
    10598   
    10699    this->outgoingEventsMutex_->lock();
     
    108101    this->outgoingEventsMutex_->unlock();
    109102  }
     103 
     104  void Connection::broadcastPacket(ENetPacket* packet, uint8_t channelID)
     105  {
     106    outgoingEvent outEvent = { 0, outgoingEventType::broadcastPacket, packet, channelID };
     107   
     108    this->outgoingEventsMutex_->lock();
     109    this->outgoingEvents_.push_back(outEvent);
     110    this->outgoingEventsMutex_->unlock();
     111  }
    110112
    111113 
     
    119121      while( enet_host_check_events( this->host_, &event ) > 0 )
    120122      {
    121 //         COUT(0) << "incoming event" << endl;
    122         // received an event
    123         this->incomingEventsMutex_->lock();
    124         this->incomingEvents_.push_back(event);
    125         this->incomingEventsMutex_->unlock();
     123        processIncomingEvent(event);
    126124      }
    127125     
     
    138136        this->outgoingEventsMutex_->unlock();
    139137       
    140         switch( outEvent.type )
    141         {
    142           case outgoingEventType::sendPacket:
    143             enet_peer_send( outEvent.peer, outEvent.channelID, outEvent.packet );
    144             break;
    145           case outgoingEventType::disconnectPeer:
    146             enet_peer_disconnect(outEvent.peer, 0);
    147             break;
    148           case outgoingEventType::broadcastPacket:
    149             enet_host_broadcast( this->host_, outEvent.channelID, outEvent.packet );
    150             break;
    151           default:
    152             assert(0);
    153         }
     138        processOutgoingEvent(outEvent);
     139       
    154140        this->outgoingEventsMutex_->lock();
    155141        outgoingEventsCount = this->outgoingEvents_.size();
     
    160146      if( enet_host_service( this->host_, &event, NETWORK_WAIT_TIMEOUT ) > 0 )
    161147      {
    162 //         COUT(0) << "incoming event after wait" << endl;
    163         //received an event
    164         this->incomingEventsMutex_->lock();
    165         this->incomingEvents_.push_back(event);
    166         this->incomingEventsMutex_->unlock();
     148        processIncomingEvent(event);
    167149      }
    168150    }
    169151  }
     152 
     153  void Connection::processIncomingEvent(ENetEvent& event)
     154  {
     155    incomingEvent inEvent;
     156    // preprocess event
     157    switch( event.type )
     158    {
     159      case ENET_EVENT_TYPE_CONNECT:
     160        inEvent = preprocessConnectEvent(event);
     161        break;
     162      case ENET_EVENT_TYPE_RECEIVE:
     163        inEvent = preprocessReceiveEvent(event);
     164        break;
     165      case ENET_EVENT_TYPE_DISCONNECT:
     166        inEvent = preprocessDisconnectEvent(event);
     167        break;
     168      case ENET_EVENT_TYPE_NONE:
     169      default:
     170        return;
     171    }
     172   
     173    // pushing event to queue
     174    this->incomingEventsMutex_->lock();
     175    this->incomingEvents_.push_back(inEvent);
     176    this->incomingEventsMutex_->unlock();
     177  }
     178 
     179  void Connection::processOutgoingEvent(outgoingEvent& event)
     180  {
     181    ENetPeer* peer;
     182    switch( event.type )
     183    {
     184      case outgoingEventType::sendPacket:
     185        assert(this->peerMap_.find(event.peerID) != this->peerMap_.end());
     186        peer = this->peerMap_[event.peerID];
     187        enet_peer_send( peer, event.channelID, event.packet );
     188        break;
     189      case outgoingEventType::disconnectPeer:
     190        assert(this->peerMap_.find(event.peerID) != this->peerMap_.end());
     191        peer = this->peerMap_[event.peerID];
     192        enet_peer_disconnect(peer, 0);
     193        break;
     194      case outgoingEventType::disconnectPeers:
     195        while( this->peerMap_.size()!=0 )
     196        {
     197          peer = this->peerMap_.begin()->second;
     198          enet_peer_disconnect(peer, 0);
     199        }
     200        break;
     201      case outgoingEventType::broadcastPacket:
     202        enet_host_broadcast( this->host_, event.channelID, event.packet );
     203        break;
     204      default:
     205        assert(0);
     206    }
     207  }
     208
    170209
    171210  void Connection::processQueue()
    172211  {
    173     ENetEvent event;
     212    incomingEvent inEvent;
    174213
    175214    this->incomingEventsMutex_->lock();
     
    178217    while( incomingEventsCount > 0 )
    179218    {
    180       packet::Packet* p;
     219      // pop event from queue
    181220      this->incomingEventsMutex_->lock();
    182       event = this->incomingEvents_.front();
     221      inEvent = this->incomingEvents_.front();
    183222      this->incomingEvents_.pop_front();
    184223      this->incomingEventsMutex_->unlock();
    185224     
    186       switch(event.type)
     225      // process event
     226      switch( inEvent.type )
    187227      {
    188         // log handling ================
    189         case ENET_EVENT_TYPE_CONNECT:
    190           addPeer( &event );
     228        case incomingEventType::peerConnect:
     229          addPeer(inEvent.peerID);
    191230          break;
    192         case ENET_EVENT_TYPE_DISCONNECT:
    193           removePeer( &event );
     231        case incomingEventType::peerDisconnect:
     232          removePeer(inEvent.peerID);
    194233          break;
    195         case ENET_EVENT_TYPE_RECEIVE:
    196 //           COUT(0) << "ENET_EVENT_TYPE_RECEIVE" << endl;
    197           p = createPacket( &event );
    198           processPacket(p);
     234        case incomingEventType::receivePacket:
     235          processPacket(inEvent.packet);
    199236          break;
    200         case ENET_EVENT_TYPE_NONE:
     237        default:
    201238          break;
    202239      }
    203240     
     241      // check whether there are still events in the queue
    204242      this->incomingEventsMutex_->lock();
    205243      incomingEventsCount = this->incomingEvents_.size();
     
    208246  }
    209247
    210   packet::Packet* Connection::createPacket(ENetEvent* event)
    211   {
    212     packet::Packet *p = packet::Packet::createPacket(event->packet, event->peer);
    213     return p;
    214 //     return p->process();
    215   }
     248  incomingEvent Connection::preprocessConnectEvent(ENetEvent& event)
     249  {
     250    // make sure this peer doesn't exist
     251    assert( this->peerMap_.find(this->nextPeerID_) == this->peerMap_.end() );
     252    assert( this->peerIDMap_.find(event.peer) == this->peerIDMap_.end() );
     253   
     254    // give peer a new id and increase peerID for next peer
     255    uint32_t peerID = this->nextPeerID_;
     256    ++this->nextPeerID_;
     257   
     258    // add peer/peerID into peerMap_ and peerIDMap_
     259    this->peerMap_[peerID] = event.peer;
     260    this->peerIDMap_[event.peer] = peerID;
     261   
     262    // create new peerEvent and return it
     263    incomingEvent inEvent = { peerID, incomingEventType::peerConnect, 0 };
     264    return inEvent;
     265  }
     266 
     267  incomingEvent Connection::preprocessDisconnectEvent(ENetEvent& event)
     268  {
     269    // assert that the peer exists and get peerID
     270    assert( this->peerIDMap_.find(event.peer) != this->peerIDMap_.end() );
     271    uint32_t peerID = this->peerIDMap_[event.peer];
     272   
     273    // remove peer/peerID from maps
     274    this->peerIDMap_.erase(this->peerIDMap_.find(event.peer));
     275    this->peerMap_.erase(this->peerMap_.find(peerID));
     276   
     277    // create new peerEvent and return it
     278    incomingEvent inEvent = { peerID, incomingEventType::peerDisconnect, 0 };
     279    return inEvent;
     280  }
     281 
     282  incomingEvent Connection::preprocessReceiveEvent(ENetEvent& event)
     283  {
     284    // assert that the peer exists and get peerID
     285    assert( this->peerIDMap_.find(event.peer) != this->peerIDMap_.end() );
     286    uint32_t peerID = this->peerIDMap_[event.peer];
     287   
     288    // create new Packet from ENetPacket
     289    packet::Packet* p = packet::Packet::createPacket(event.packet, peerID);
     290   
     291    // create new peerEvent and return it
     292    incomingEvent inEvent = { peerID, incomingEventType::receivePacket, p };
     293    return inEvent;
     294  }
     295
    216296 
    217297  void Connection::enableCompression()
  • code/branches/network6/src/libraries/network/Connection.h

    r7801 r7823  
    4444
    4545#include <deque>
     46#include <map>
    4647#include <enet/enet.h>
     48#include <boost/concept_check.hpp>
    4749
    4850namespace boost
     
    5961  const unsigned int NETWORK_MAX_QUEUE_PROCESS_TIME = 5;
    6062 
     63  namespace incomingEventType
     64  {
     65    enum Value
     66    {
     67      receivePacket   = 1,  // incoming packet
     68      peerConnect     = 2,  // incoming connect request
     69      peerDisconnect  = 3   // incoming disconnect request
     70    };
     71   
     72  }
     73 
    6174  namespace outgoingEventType
    6275  {
    6376    enum Value
    6477    {
    65       sendPacket      = 1,
    66       disconnectPeer  = 2,
    67       broadcastPacket = 3
     78      sendPacket      = 1,  // outgoing packet
     79      broadcastPacket = 2,  // outgoing broadcast packet
     80      disconnectPeer  = 3,  // outgoing disconnect request
     81      disconnectPeers = 4   // outgoing disconnect request
    6882    };
    6983   
    7084  }
    7185 
     86  struct _NetworkExport incomingEvent
     87  {
     88    uint32_t                  peerID;
     89    incomingEventType::Value  type;
     90    packet::Packet*           packet;
     91  };
     92 
    7293  struct _NetworkExport outgoingEvent
    7394  {
    74     ENetPeer*                 peer;
     95    uint32_t                  peerID;
    7596    outgoingEventType::Value  type;
    7697    ENetPacket*               packet;
     
    83104    virtual ~Connection();
    84105
    85     void addPacket(ENetPacket *packet, ENetPeer *peer, uint8_t channelID);
    86     void broadcastPacket(ENetPacket* packet, uint8_t channelID);
    87 //     ENetHost* getHost(){ return this->host_; }
    88 
    89106  protected:
    90107    Connection();
    91 //     static Connection* getInstance(){ return Connection::instance_; }
    92 
    93 //     int service(ENetEvent* event);
     108   
    94109    void startCommunicationThread();
    95110    void stopCommunicationThread();
    96     void communicationThread();
    97     virtual void disconnectPeer(ENetPeer *peer);
     111   
     112    void addPacket(ENetPacket *packet, uint32_t peerID, uint8_t channelID);
     113    void broadcastPacket(ENetPacket* packet, uint8_t channelID);
     114    void disconnectPeer(uint32_t peerID);
     115    void disconnectPeers();
    98116   
    99117    void enableCompression();
    100118
    101119    void processQueue();
    102     virtual void addPeer(ENetEvent* event)=0;
    103     virtual void removePeer(ENetEvent* event)=0;
     120    virtual void addPeer(uint32_t peerID)=0;
     121    virtual void removePeer(uint32_t peerID)=0;
    104122    virtual void processPacket( packet::Packet* packet)=0;
    105     virtual packet::Packet* createPacket(ENetEvent* event);
     123   
     124    incomingEvent preprocessConnectEvent(ENetEvent& event);
     125    incomingEvent preprocessDisconnectEvent(ENetEvent& event);
     126    incomingEvent preprocessReceiveEvent(ENetEvent& event);
     127   
     128    void processIncomingEvent(ENetEvent& event);
     129    void processOutgoingEvent(outgoingEvent& event);
    106130
    107     ENetHost*                   host_;
     131    ENetHost*                     host_;
    108132  private:
    109     boost::thread*              communicationThread_;
    110     bool                        bCommunicationThreadRunning_;
    111     ENetAddress*                bindAddress_;
    112     std::deque<ENetEvent>       incomingEvents_;
    113     std::deque<outgoingEvent>   outgoingEvents_;
    114     boost::mutex*               incomingEventsMutex_;
    115     boost::mutex*               outgoingEventsMutex_;
     133    void communicationThread();
     134   
     135    boost::thread*                communicationThread_;
     136    bool                          bCommunicationThreadRunning_;
     137    ENetAddress*                  bindAddress_;
     138    std::deque<incomingEvent>     incomingEvents_;
     139    std::deque<outgoingEvent>     outgoingEvents_;
     140    boost::mutex*                 incomingEventsMutex_;
     141    boost::mutex*                 outgoingEventsMutex_;
     142    std::map<uint32_t, ENetPeer*> peerMap_;
     143    std::map<ENetPeer*, uint32_t> peerIDMap_;
     144    uint32_t                      nextPeerID_;
    116145
    117146//     static Connection *instance_;
  • code/branches/network6/src/libraries/network/GamestateManager.h

    r7801 r7823  
    101101      { assert(peerMap_.find(peerID)!=peerMap_.end()); peerMap_[peerID].isSynched = true; }
    102102    void removePeer( uint32_t peerID );
     103    bool hasPeers(){ return this->peerMap_.size()!=0; }
    103104//     void removeClient(ClientInformation *client);
    104105  protected:
  • code/branches/network6/src/libraries/network/Host.cc

    r7801 r7823  
    115115    {
    116116      for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
    117         it->incomingChat(message, CLIENTID_UNKNOWN);
     117        it->incomingChat(message, NETWORK_PEER_ID_BROADCAST);
    118118      return true;
    119119    }
  • code/branches/network6/src/libraries/network/NetworkPrereqs.h

    r7801 r7823  
    6565{
    6666  static const unsigned int GAMESTATEID_INITIAL       = static_cast<unsigned int>(-1);
    67   static const unsigned int CLIENTID_UNKNOWN          = static_cast<unsigned int>(-2);
    6867  extern const char* LAN_DISCOVERY_MESSAGE;
    6968  extern const char* LAN_DISCOVERY_ACK;
    7069  static const unsigned int LAN_DISCOVERY_PORT          = 55558;
    7170  static const unsigned int NETWORK_PEER_ID_SERVER      = 0;
     71  static const unsigned int NETWORK_PEER_ID_BROADCAST   = static_cast<unsigned int>(-1);
     72  static const unsigned int NETWORK_PEER_ID_UNKNOWN     = static_cast<unsigned int>(-2);
    7273  static const unsigned int NETWORK_CHANNEL_DEFAULT     = 0;
    7374  static const unsigned int NETWORK_CHANNEL_UNRELIABLE  = 1;
  • code/branches/network6/src/libraries/network/Server.cc

    r7801 r7823  
    5757#include "packet/Welcome.h"
    5858#include "ChatListener.h"
    59 #include "ClientInformation.h"
     59// #include "ClientInformation.h"
    6060#include "FunctionCallManager.h"
    6161#include "GamestateManager.h"
     
    152152  bool Server::processChat(const std::string& message, unsigned int playerID)
    153153  {
    154     ClientInformation *temp = ClientInformation::getBegin();
     154//     ClientInformation *temp = ClientInformation::getBegin();
    155155    packet::Chat *chat;
    156     while(temp){
    157       chat = new packet::Chat(message, playerID);
    158       chat->setPeerID(temp->getID());
    159       if(!chat->send( static_cast<Host*>(this) ))
    160         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
    161       temp = temp->next();
    162     }
     156//     while(temp){
     157    chat = new packet::Chat(message, playerID);
     158    chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
     159    chat->send( static_cast<Host*>(this) );
     160//         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
     161//       temp = temp->next();
     162//     }
    163163//    COUT(1) << "Player " << playerID << ": " << message << std::endl;
    164164    return true;
     
    207207    //helper_HandleMasterServerRequests();
    208208
    209     if ( ClientInformation::hasClients() )
     209    if ( GamestateManager::hasPeers() )
    210210    {
    211211      // process incoming gamestates
     
    237237  unsigned int Server::getRTT(unsigned int clientID)
    238238  {
    239     assert(ClientInformation::findClient(clientID));
    240     return ClientInformation::findClient(clientID)->getRTT();
     239//     assert(ClientInformation::findClient(clientID));
     240//     return ClientInformation::findClient(clientID)->getRTT();
     241    // TODO: reimplement
     242    return 0;
    241243  }
    242244
    243245  void Server::printRTT()
    244246  {
    245     for( ClientInformation* temp=ClientInformation::getBegin(); temp!=0; temp=temp->next() )
    246       COUT(0) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
     247//     for( ClientInformation* temp=ClientInformation::getBegin(); temp!=0; temp=temp->next() )
     248//       COUT(0) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
    247249  }
    248250
     
    252254  double Server::getPacketLoss(unsigned int clientID)
    253255  {
    254     assert(ClientInformation::findClient(clientID));
    255     return ClientInformation::findClient(clientID)->getPacketLoss();
     256//     assert(ClientInformation::findClient(clientID));
     257//     return ClientInformation::findClient(clientID)->getPacketLoss();
     258    return 0.;
    256259  }
    257260
     
    261264  void Server::updateGamestate()
    262265  {
    263     if( ClientInformation::getBegin()==NULL )
     266    if( this->clientIDs_.size()==0 )
    264267      //no client connected
    265268      return;
     
    291294  bool Server::sendObjectDeletes()
    292295  {
    293     ClientInformation *temp = ClientInformation::getBegin();
    294     if( temp == NULL )
     296//     ClientInformation *temp = ClientInformation::getBegin();
     297//     if( temp == NULL )
    295298      //no client connected
     299    if( this->clientIDs_.size()==0 )
    296300      return true;
    297301    packet::DeleteObjects *del = new packet::DeleteObjects();
     
    302306    }
    303307//     COUT(3) << "sending DeleteObjects" << std::endl;
    304     while(temp != NULL){
    305       if( !(temp->getSynched()) )
    306       {
    307         COUT(5) << "Server: not sending gamestate" << std::endl;
    308         temp=temp->next();
    309         continue;
    310       }
    311       int cid = temp->getID(); //get client id
    312       packet::DeleteObjects *cd = new packet::DeleteObjects(*del);
    313       assert(cd);
    314       cd->setPeerID(cid);
    315       if ( !cd->send( static_cast<Host*>(this) ) )
    316         COUT(3) << "Server: packet with client id (cid): " << cid << " not sended" << std::endl;
    317       temp=temp->next();
     308//     while(temp != NULL){
     309//       if( !(temp->getSynched()) )
     310//       {
     311//         COUT(5) << "Server: not sending gamestate" << std::endl;
     312//         temp=temp->next();
     313//         continue;
     314//       }
     315//       int cid = temp->getID(); //get client id
     316//       packet::DeleteObjects *cd = new packet::DeleteObjects(*del);
     317//       assert(cd);
     318    del->setPeerID(NETWORK_PEER_ID_BROADCAST);
     319    if ( !del->send( static_cast<Host*>(this) ) )
     320      COUT(3) << "Server: could not broadcast deleteObjects packet" << std::endl;
     321//       temp=temp->next();
    318322      // gs gets automatically deleted by enet callback
    319     }
    320     delete del;
     323//     }
     324//     delete del;
    321325    return true;
    322326  }
    323327
    324328
    325   void Server::addPeer(ENetEvent *event)
    326   {
    327     static unsigned int newid=1;
    328 
    329     COUT(2) << "Server: adding client" << std::endl;
    330     ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
    331     if(!temp)
    332     {
    333       COUT(2) << "Server: could not add client" << std::endl;
    334     }
    335     temp->setID(newid);
    336     temp->setPeer(event->peer);
     329  void Server::addPeer(uint32_t peerID)
     330  {
     331//     static unsigned int newid=1;
     332//
     333//     COUT(2) << "Server: adding client" << std::endl;
     334//     ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
     335//     if(!temp)
     336//     {
     337//       COUT(2) << "Server: could not add client" << std::endl;
     338//     }
     339//     temp->setID(newid);
     340//     temp->setPeer(event->peer);
    337341
    338342    // inform all the listeners
    339     ClientConnectionListener::broadcastClientConnected(newid);
    340     GamestateManager::addPeer(newid);
    341 
    342     ++newid;
    343 
    344     COUT(3) << "Server: added client id: " << temp->getID() << std::endl;
    345     createClient(temp->getID());
     343    this->clientIDs_.push_back(peerID);
     344    ClientConnectionListener::broadcastClientConnected(peerID);
     345    GamestateManager::addPeer(peerID);
     346
     347//     ++newid;
     348
     349    COUT(3) << "Server: added client id: " << peerID << std::endl;
     350    createClient(peerID);
    346351}
    347352
    348   void Server::removePeer(ENetEvent *event)
     353  void Server::removePeer(uint32_t peerID)
    349354  {
    350355    COUT(4) << "removing client from list" << std::endl;
    351     ClientInformation *client = ClientInformation::findClient(&event->peer->address);
    352     if(!client)
    353       return;
    354     else
    355     {
    356       GamestateManager::removePeer(client->getID());
     356//     ClientInformation *client = ClientInformation::findClient(&event->peer->address);
     357//     if(!client)
     358//       return;
     359//     else
     360//     {
     361  std::vector<uint32_t>::iterator it;
     362  for( it=this->clientIDs_.begin(); it!=this->clientIDs_.end(); ++it )
     363  {
     364    if( *it == peerID )
     365    {
     366      this->clientIDs_.erase(it);
     367      break;
     368    }
     369  }
     370  ClientConnectionListener::broadcastClientDisconnected(peerID);
     371  GamestateManager::removePeer(peerID);
    357372      //ServerConnection::disconnectClient( client );
    358373      //ClientConnectionListener::broadcastClientDisconnected( client->getID() ); //this is done in ClientInformation now
    359       delete client;
    360     }
     374//       delete client;
     375//     }
    361376  }
    362377 
     
    377392  bool Server::createClient(int clientID)
    378393  {
    379     ClientInformation *temp = ClientInformation::findClient(clientID);
    380     if(!temp)
    381     {
    382       COUT(2) << "Conn.Man. could not create client with id: " << clientID << std::endl;
    383       return false;
    384     }
    385     COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
     394//     ClientInformation *temp = ClientInformation::findClient(clientID);
     395//     if(!temp)
     396//     {
     397//       COUT(2) << "Server. could not create client with id: " << clientID << std::endl;
     398//       return false;
     399//     }
     400//     COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
    386401
    387402    // synchronise class ids
    388     syncClassid(temp->getID());
     403    syncClassid(clientID);
    389404
    390405    // now synchronise functionIDs
     
    394409    assert(b);
    395410
    396     temp->setSynched(true);
     411//     temp->setSynched(true);
    397412    GamestateManager::setSynched(clientID);
    398413   
    399414    COUT(4) << "sending welcome" << std::endl;
    400     packet::Welcome *w = new packet::Welcome(temp->getID(), temp->getShipID());
    401     w->setPeerID(temp->getID());
     415    packet::Welcome *w = new packet::Welcome(clientID, OBJECTID_UNKNOWN);
     416    w->setPeerID(clientID);
    402417    b = w->send( static_cast<Host*>(this) );
    403418    assert(b);
    404419    packet::Gamestate *g = new packet::Gamestate();
    405     g->setPeerID(temp->getID());
     420    g->setPeerID(clientID);
    406421    b = g->collectData(0,packet::GAMESTATE_MODE_SERVER);
    407422    assert(b);
     
    415430  }
    416431
    417   void Server::disconnectClient( ClientInformation *client )
    418   {
    419     ServerConnection::disconnectClient( client );
    420     GamestateManager::removePeer(client->getID());
     432  void Server::disconnectClient( uint32_t clientID )
     433  {
     434    ServerConnection::disconnectClient( clientID );
     435    GamestateManager::removePeer( clientID );
    421436    // inform all the listeners
    422437    // ClientConnectionListener::broadcastClientDisconnected(client->getID()); // this is done in ClientInformation now
     
    430445  bool Server::broadcast(const std::string& message)
    431446  {
    432       return this->sendChat(message, CLIENTID_UNKNOWN);
     447      return this->sendChat(message, NETWORK_PEER_ID_BROADCAST);
    433448  }
    434449
    435450  bool Server::sendChat(const std::string& message, unsigned int clientID)
    436451  {
    437     ClientInformation *temp = ClientInformation::getBegin();
     452//     ClientInformation *temp = ClientInformation::getBegin();
    438453    packet::Chat *chat;
    439     while(temp)
     454//     while(temp)
    440455    {
    441456      chat = new packet::Chat(message, clientID);
    442       chat->setPeerID(temp->getID());
    443       if(!chat->send( static_cast<Host*>(this) ))
    444         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
    445       temp = temp->next();
     457      chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
     458      chat->send( static_cast<Host*>(this) );
     459//         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
     460//       temp = temp->next();
    446461    }
    447462//    COUT(1) << "Player " << Host::getPlayerID() << ": " << message << std::endl;
  • code/branches/network6/src/libraries/network/Server.h

    r7801 r7823  
    3333
    3434#include <deque>
     35#include <vector>
    3536
    3637#include "util/UtilPrereqs.h"
     
    8081    unsigned int playerID(){return 0;}
    8182
    82     void addPeer(ENetEvent *event);
    83     void removePeer(ENetEvent *event);
     83    void addPeer(uint32_t peerID);
     84    void removePeer(uint32_t peerID);
    8485    void processPacket(packet::Packet* packet);
    8586
    8687    bool createClient(int clientID);
    87     void disconnectClient( ClientInformation *client);
     88    void disconnectClient( uint32_t clientID );
    8889    bool sendGameStates();
    8990    bool sendObjectDeletes();
     
    9596    float timeSinceLastUpdate_;
    9697    std::deque<packet::Packet*> packetQueue_;
     98    std::vector<uint32_t>       clientIDs_;
    9799  };
    98100
  • code/branches/network6/src/libraries/network/ServerConnection.cc

    r7801 r7823  
    3535
    3636#include "util/Debug.h"
    37 #include "ClientInformation.h"
     37// #include "ClientInformation.h"
    3838
    3939namespace orxonox
     
    104104  void ServerConnection::addPacket(ENetPacket *packet, unsigned int clientID, uint8_t channelID)
    105105  {
    106     if ( clientID == CLIENTID_UNKNOWN )
     106    if ( clientID == NETWORK_PEER_ID_BROADCAST )
    107107    {
    108108      broadcastPacket(packet, channelID);
     
    110110    else
    111111    {
    112       ClientInformation *temp = ClientInformation::findClient(clientID);
    113       if(!temp){
    114         COUT(3) << "C.Man: addPacket findClient failed" << std::endl;
    115       }
    116       Connection::addPacket(packet, temp->getPeer(), channelID);
     112//       ClientInformation *temp = ClientInformation::findClient(clientID);
     113//       if(!temp){
     114//         COUT(3) << "C.Man: addPacket findClient failed" << std::endl;
     115//       }
     116      Connection::addPacket(packet, clientID, channelID);
    117117    }
    118118  }
    119119
    120   void ServerConnection::disconnectClient(ClientInformation *client)
    121   {
    122     Connection::disconnectPeer( client->getPeer() );
    123   }
     120//   void ServerConnection::disconnectClient(ClientInformation *client)
     121//   {
     122//     Connection::disconnectPeer( client->getPeer() );
     123//   }
    124124
    125125  void ServerConnection::disconnectClient(int clientID)
    126126  {
    127     ClientInformation *client = ClientInformation::findClient(clientID);
    128     if(client)
    129       ServerConnection::disconnectClient(client);
     127//     ClientInformation *client = ClientInformation::findClient(clientID);
     128//     if(client)
     129    ServerConnection::disconnectClient(clientID);
    130130  }
    131131
    132132  void ServerConnection::disconnectClients()
    133133  {
    134     ClientInformation *temp = ClientInformation::getBegin();
    135     while(temp!=0)
    136     {
    137       ServerConnection::disconnectClient( temp );
    138       temp = temp->next();
    139     }
     134    Connection::disconnectPeers();
     135//     ClientInformation *temp = ClientInformation::getBegin();
     136//     while(temp!=0)
     137//     {
     138//       ServerConnection::disconnectClient( temp );
     139//       temp = temp->next();
     140//     }
    140141    return;
    141142  }
    142143
    143144
    144   int ServerConnection::getClientID(ENetPeer* peer)
    145   {
    146     return getClientID(&(peer->address));
    147   }
     145//   int ServerConnection::getClientID(ENetPeer* peer)
     146//   {
     147//     return getClientID(&(peer->address));
     148//   }
    148149
    149   int ServerConnection::getClientID(ENetAddress* address)
    150   {
    151     return ClientInformation::findClient(address)->getID();
    152   }
    153 
    154   ENetPeer *ServerConnection::getClientPeer(int clientID)
    155   {
    156     return ClientInformation::findClient(clientID)->getPeer();
    157   }
     150//   int ServerConnection::getClientID(ENetAddress* address)
     151//   {
     152//     return ClientInformation::findClient(address)->getID();
     153//   }
     154//
     155//   ENetPeer *ServerConnection::getClientPeer(int clientID)
     156//   {
     157//     return ClientInformation::findClient(clientID)->getPeer();
     158//   }
    158159
    159160
  • code/branches/network6/src/libraries/network/ServerConnection.h

    r7801 r7823  
    5757    bool closeListener();
    5858    void addPacket(ENetPacket *packet, unsigned int ID, uint8_t channelID);
    59     virtual void disconnectClient(ClientInformation *client);
     59//     virtual void disconnectClient(ClientInformation *client);
    6060    void disconnectClient(int clientID);
    6161  protected:
     
    6464
    6565  private:
    66     int getClientID(ENetPeer* peer);
    67     int getClientID(ENetAddress* address);
    68     ENetPeer* getClientPeer(int clientID);
     66//     int getClientID(ENetPeer* peer);
     67//     int getClientID(ENetAddress* address);
     68//     ENetPeer* getClientPeer(int clientID);
    6969
    7070    ENetAddress* bindAddress_;
  • code/branches/network6/src/libraries/network/packet/Packet.cc

    r7801 r7823  
    4747#include "Welcome.h"
    4848#include "network/Host.h"
    49 #include "network/ClientInformation.h"
     49// #include "network/ClientInformation.h"
    5050
    5151namespace orxonox{
     
    8585
    8686
    87 Packet::Packet(const Packet &p){
     87Packet::Packet(const Packet &p)
     88{
    8889  enetPacket_=p.enetPacket_;
    8990  flags_=p.flags_;
     
    104105    That also means destroying the ENetPacket if one exists. There
    105106*/
    106 Packet::~Packet(){
     107Packet::~Packet()
     108{
    107109  // Deallocate data_ memory if necessary.
    108   if (this->bDataENetAllocated_){
     110  if (this->bDataENetAllocated_)
     111  {
    109112    // In this case ENet allocated data_ and will destroy it.
    110113  }
    111   else if (this->data_) {
     114  else if (this->data_)
     115  {
    112116    // This destructor was probably called as a consequence of ENet executing our callback.
    113117    // It simply serves us to be able to deallocate the packet content (data_) ourselves since
     
    119123  // Note: For the case ENet used the callback to destroy the packet, we have already set
    120124  // enetPacket_ to NULL to avoid destroying it again.
    121   if (this->enetPacket_){
     125  if (this->enetPacket_)
     126  {
    122127    // enetPacket_->data gets destroyed too by ENet if it was allocated by it.
    123128    enet_packet_destroy(enetPacket_);
     
    125130}
    126131
    127 bool Packet::send(orxonox::Host* host){
    128   if(packetDirection_ != Direction::Outgoing && packetDirection_ != Direction::Bidirectional ){
     132bool Packet::send(orxonox::Host* host)
     133{
     134  if(packetDirection_ != Direction::Outgoing && packetDirection_ != Direction::Bidirectional )
     135  {
    129136    assert(0);
    130137    return false;
    131138  }
    132   if(!enetPacket_){
     139  if(!enetPacket_)
     140  {
    133141    if(!data_){
    134142      assert(0);
     
    175183}
    176184
    177 Packet *Packet::createPacket(ENetPacket *packet, ENetPeer *peer){
     185Packet *Packet::createPacket(ENetPacket* packet, uint32_t peerID)
     186{
    178187  uint8_t *data = packet->data;
    179   assert(ClientInformation::findClient(&peer->address)->getID() != static_cast<unsigned int>(-2) || !Host::isServer());
    180   unsigned int peerID = ClientInformation::findClient(&peer->address)->getID();
     188//   assert(ClientInformation::findClient(&peer->address)->getID() != static_cast<unsigned int>(-2) || !Host::isServer());
     189//   unsigned int peerID = ClientInformation::findClient(&peer->address)->getID();
    181190  // HACK
    182   if( peerID==static_cast<unsigned int>(-2))
    183     peerID = NETWORK_PEER_ID_SERVER;
     191//   if( peerID==static_cast<unsigned int>(-2))
     192//     peerID = NETWORK_PEER_ID_SERVER;
    184193  Packet *p = 0;
    185194//   COUT(6) << "packet type: " << *(Type::Value *)&data[_PACKETID] << std::endl;
     
    235244    data we allocated ourselves.
    236245*/
    237 void Packet::deletePacket(ENetPacket *enetPacket){
     246void Packet::deletePacket(ENetPacket *enetPacket)
     247{
    238248  // Get our Packet from a global map with all Packets created in the send() method of Packet.
    239249  Packet::packetMapMutex_.lock();
  • code/branches/network6/src/libraries/network/packet/Packet.h

    r7801 r7823  
    3232#include <map>
    3333
    34 namespace orxonox {
     34namespace orxonox
     35{
    3536
    36 namespace packet{
     37namespace packet
     38{
    3739
    38 namespace Direction{
    39   enum Value{
     40namespace Direction
     41{
     42  enum Value
     43  {
    4044    Incoming,
    4145    Outgoing,
     
    4347  };
    4448}
    45 namespace Type{
    46   enum Value{
     49namespace Type
     50{
     51  enum Value
     52  {
    4753    Acknowledgement,
    4854    Chat,
     
    5965    @author Oliver Scheuss <scheusso [at] ee.ethz.ch>
    6066*/
    61 class _NetworkExport Packet{
     67class _NetworkExport Packet
     68{
    6269  public:
    6370    Packet(const Packet &p);
    6471    virtual ~Packet();
    65     static Packet *createPacket(ENetPacket *packet, ENetPeer *peer);
    66     static void deletePacket(ENetPacket *packet);
     72    static Packet* createPacket(ENetPacket* packet, uint32_t peerID);
     73    static void deletePacket(ENetPacket* packet);
    6774
    68     virtual unsigned char *getData(){ return data_; };
     75    virtual unsigned char* getData(){ return data_; };
    6976    virtual unsigned int getSize() const =0;
    7077    virtual bool process(orxonox::Host* host)=0;
  • code/branches/network6/src/modules/overlays/hud/ChatOverlay.cc

    r7284 r7823  
    7171        std::string text;
    7272
    73         if (senderID != CLIENTID_UNKNOWN)
     73        if (senderID != NETWORK_PEER_ID_UNKNOWN)
    7474        {
    7575            std::string name = "unknown";
  • code/branches/network6/src/orxonox/ChatHistory.cc

    r7284 r7823  
    8282#ifndef CHATTEST
    8383    /* get sender ID and prepend it to the message */
    84     if (senderID != CLIENTID_UNKNOWN)
     84    if (senderID != NETWORK_PEER_ID_UNKNOWN)
    8585    {
    8686      /* if we can't find anything, use "unknown" as default */
  • code/branches/network6/src/orxonox/ChatInputHandler.cc

    r7284 r7823  
    207207
    208208    /* setup player name info */
    209     if (senderID != CLIENTID_UNKNOWN)
     209    if (senderID != NETWORK_PEER_ID_UNKNOWN)
    210210    {
    211211       PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
  • code/branches/network6/src/orxonox/PlayerManager.cc

    r7474 r7823  
    4545        RegisterRootObject(PlayerManager);
    4646
    47         this->getConnectedClients();
     47//         this->getConnectedClients();
    4848    }
    4949
  • code/branches/network6/src/orxonox/gamestates/GSRoot.cc

    r7284 r7823  
    160160    {
    161161        if (!GameMode::isStandalone())
    162             callStaticNetworkFunction(&TimeFactorListener::setTimeFactor, CLIENTID_UNKNOWN, factor_new);
     162            callStaticNetworkFunction(&TimeFactorListener::setTimeFactor, NETWORK_PEER_ID_BROADCAST, factor_new);
    163163    }
    164164}
  • code/branches/network6/src/orxonox/gametypes/Dynamicmatch.cc

    r7284 r7823  
    452452                    if (!it->first)//in order to catch nullpointer
    453453                        continue;
    454                     if (it->first->getClientID() == CLIENTID_UNKNOWN)
     454                    if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    455455                        continue;
    456456                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     
    467467                       if (!it->first)//in order to catch nullpointer
    468468                           continue;
    469                        if (it->first->getClientID() == CLIENTID_UNKNOWN)
     469                       if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    470470                           continue;
    471471                       else if (it->second==chaser)
     
    501501                    if (!it->first)//in order to catch nullpointer
    502502                        continue;
    503                     if (it->first->getClientID() == CLIENTID_UNKNOWN)
     503                    if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    504504                        continue;
    505505                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     
    516516                       if (!it->first)
    517517                           continue;
    518                        if (it->first->getClientID() == CLIENTID_UNKNOWN)
     518                       if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    519519                           continue;
    520520                       else if (it->second==chaser)
     
    551551                    if (!it->first)//in order to catch nullpointer
    552552                        continue;
    553                     if (it->first->getClientID() == CLIENTID_UNKNOWN)
     553                    if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    554554                        continue;
    555555                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     
    566566                       if (!it->first)
    567567                           continue;
    568                        if (it->first->getClientID() == CLIENTID_UNKNOWN)
     568                       if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    569569                           continue;
    570570                       else if (it->second==chaser)
     
    632632            for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    633633            {
    634                 if (it->first->getClientID() == CLIENTID_UNKNOWN)
     634                if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    635635                    continue;
    636636                this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
  • code/branches/network6/src/orxonox/gametypes/Gametype.cc

    r7801 r7823  
    262262                        it->second.frags_++;
    263263
    264                         if (killer->getPlayer()->getClientID() != CLIENTID_UNKNOWN)
     264                        if (killer->getPlayer()->getClientID() != NETWORK_PEER_ID_UNKNOWN)
    265265                            this->gtinfo_->sendKillMessage("You killed " + victim->getPlayer()->getName(), killer->getPlayer()->getClientID());
    266                         if (victim->getPlayer()->getClientID() != CLIENTID_UNKNOWN)
     266                        if (victim->getPlayer()->getClientID() != NETWORK_PEER_ID_UNKNOWN)
    267267                            this->gtinfo_->sendDeathMessage("You were killed by " + killer->getPlayer()->getName(), victim->getPlayer()->getClientID());
    268268                    }
  • code/branches/network6/src/orxonox/gametypes/LastManStanding.cc

    r7655 r7823  
    8686            if (it != this->players_.end())
    8787            {
    88                 if (it->first->getClientID()== CLIENTID_UNKNOWN)
     88                if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    8989                    return true;
    9090                const std::string& message = ""; // resets Camper-Warning-message
     
    131131        for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    132132        {
    133             if (it->first->getClientID() == CLIENTID_UNKNOWN)
     133            if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    134134                continue;
    135135
     
    194194        if (it != this->players_.end())
    195195        {
    196             if (it->first->getClientID()== CLIENTID_UNKNOWN)
     196            if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    197197                return;
    198198            const std::string& message = ""; // resets Camper-Warning-message
     
    249249                    this->inGame_[it->first]=true;
    250250
    251                     if (it->first->getClientID()== CLIENTID_UNKNOWN)
     251                    if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    252252                        continue;
    253253                    int output=1+playerDelayTime_[it->first];
     
    261261                    {
    262262                        this->punishPlayer(it->first);
    263                         if (it->first->getClientID()== CLIENTID_UNKNOWN)
     263                        if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    264264                            return;
    265265                        const std::string& message = ""; // resets Camper-Warning-message
     
    269269                else if (it->second<timeRemaining/5)//Warning message
    270270                {
    271                     if (it->first->getClientID()== CLIENTID_UNKNOWN)
     271                    if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    272272                        continue;
    273273                    const std::string& message = "Camper Warning! Don't forget to shoot.";
  • code/branches/network6/src/orxonox/gametypes/TeamBaseMatch.cc

    r7284 r7823  
    190190            for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    191191            {
    192                 if (it->first->getClientID() == CLIENTID_UNKNOWN)
     192                if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    193193                    continue;
    194194
  • code/branches/network6/src/orxonox/gametypes/UnderAttack.cc

    r6417 r7823  
    7676        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    7777        {
    78             if (it->first->getClientID() == CLIENTID_UNKNOWN)
     78            if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    7979                continue;
    8080
     
    158158                for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    159159                {
    160                     if (it->first->getClientID() == CLIENTID_UNKNOWN)
     160                    if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    161161                        continue;
    162162
  • code/branches/network6/src/orxonox/infos/GametypeInfo.cc

    r7163 r7823  
    7474        if (GameMode::isMaster())
    7575        {
    76             callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), CLIENTID_UNKNOWN, message);
     76            callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);
    7777            this->dispatchAnnounceMessage(message);
    7878        }
  • code/branches/network6/src/orxonox/infos/HumanPlayer.cc

    r6417 r7823  
    3232#include "core/ConfigValueIncludes.h"
    3333#include "core/GameMode.h"
    34 #include "network/ClientInformation.h"
     34// #include "network/ClientInformation.h"
    3535#include "network/Host.h"
    3636#include "controllers/HumanController.h"
     
    144144    float HumanPlayer::getPing() const
    145145    {
    146         return static_cast<float>(ClientInformation::findClient(this->getClientID())->getRTT());
     146//         return static_cast<float>(ClientInformation::findClient(this->getClientID())->getRTT());
     147        return 0.; //TODO: reimplement this
    147148    }
    148149
    149150    float HumanPlayer::getPacketLossRatio() const
    150151    {
    151         return static_cast<float>(ClientInformation::findClient(this->getClientID())->getPacketLoss());
     152      //         return static_cast<float>(ClientInformation::findClient(this->getClientID())->getPacketLoss());
     153        return 0.; //TODO: reimplement this
    152154    }
    153155
  • code/branches/network6/src/orxonox/infos/PlayerInfo.cc

    r7163 r7823  
    3232
    3333#include "core/CoreIncludes.h"
    34 #include "network/ClientInformation.h"
     34// #include "network/ClientInformation.h"
    3535#include "gametypes/Gametype.h"
    3636#include "worldentities/ControllableEntity.h"
     
    4343        RegisterObject(PlayerInfo);
    4444
    45         this->clientID_ = CLIENTID_UNKNOWN;
     45        this->clientID_ = NETWORK_PEER_ID_UNKNOWN;
    4646        this->bHumanPlayer_ = false;
    4747        this->bLocalPlayer_ = false;
Note: See TracChangeset for help on using the changeset viewer.