Index: /code/branches/network6/src/libraries/network/CMakeLists.txt
===================================================================
--- /code/branches/network6/src/libraries/network/CMakeLists.txt	(revision 7822)
+++ /code/branches/network6/src/libraries/network/CMakeLists.txt	(revision 7823)
@@ -22,5 +22,4 @@
   Client.cc
   ClientConnection.cc
-  ClientInformation.cc
   ClientConnectionListener.cc
   Connection.cc
@@ -50,5 +49,4 @@
   ClientConnection.h
   ClientConnectionListener.h
-  ClientInformation.h
   Connection.h
   FunctionCall.h
Index: /code/branches/network6/src/libraries/network/ClientConnection.cc
===================================================================
--- /code/branches/network6/src/libraries/network/ClientConnection.cc	(revision 7822)
+++ /code/branches/network6/src/libraries/network/ClientConnection.cc	(revision 7823)
@@ -103,4 +103,8 @@
       if( enet_host_service(this->host_, &event, NETWORK_CLIENT_WAIT_TIME)>=0 && event.type == ENET_EVENT_TYPE_CONNECT )
       {
+        // manually add server to list of peers
+        /*incomingEvent inEvent = */Connection::preprocessConnectEvent(event);
+//         addPeer(inEvent.peerID);
+        // start communication thread
         this->established_=true;
         Connection::startCommunicationThread();
@@ -148,12 +152,14 @@
     assert( this->server_ );
     assert( packet );
-    return Connection::addPacket( packet, this->server_, channelID );
+//     return Connection::addPacket( packet, NETWORK_PEER_ID_SERVER, channelID );
+    // HACK: actually there should be a way to do this using addPacket and the correct peerID
+    return Connection::broadcastPacket(packet, channelID);
   }
 
-  void ClientConnection::addPeer(ENetEvent* event)
+  void ClientConnection::addPeer(uint32_t peerID)
   {
     assert(0);
   }
-  void ClientConnection::removePeer(ENetEvent* event)
+  void ClientConnection::removePeer(uint32_t peerID)
   {
     this->established_=false;
Index: /code/branches/network6/src/libraries/network/ClientConnection.h
===================================================================
--- /code/branches/network6/src/libraries/network/ClientConnection.h	(revision 7822)
+++ /code/branches/network6/src/libraries/network/ClientConnection.h	(revision 7823)
@@ -57,6 +57,6 @@
     uint32_t getRTT();
   private:
-    virtual void addPeer(ENetEvent* event);
-    virtual void removePeer(ENetEvent* event);
+    virtual void addPeer(uint32_t peerID);
+    virtual void removePeer(uint32_t peerID);
 
     bool disconnectConnection();
Index: /code/branches/network6/src/libraries/network/ClientConnectionListener.cc
===================================================================
--- /code/branches/network6/src/libraries/network/ClientConnectionListener.cc	(revision 7822)
+++ /code/branches/network6/src/libraries/network/ClientConnectionListener.cc	(revision 7823)
@@ -31,5 +31,5 @@
 #include "core/CoreIncludes.h"
 #include "core/GameMode.h"
-#include "ClientInformation.h"
+// #include "ClientInformation.h"
 
 namespace orxonox
@@ -52,13 +52,13 @@
     }
 
-    void ClientConnectionListener::getConnectedClients()
-    {
-        ClientInformation* client = ClientInformation::getBegin();
-        while (client)
-        {
-            this->clientConnected(client->getID());
-            client = client->next();
-        }
-    }
+//     void ClientConnectionListener::getConnectedClients()
+//     {
+//         ClientInformation* client = ClientInformation::getBegin();
+//         while (client)
+//         {
+//             this->clientConnected(client->getID());
+//             client = client->next();
+//         }
+//     }
 }
 
Index: /code/branches/network6/src/libraries/network/ClientConnectionListener.h
===================================================================
--- /code/branches/network6/src/libraries/network/ClientConnectionListener.h	(revision 7822)
+++ /code/branches/network6/src/libraries/network/ClientConnectionListener.h	(revision 7823)
@@ -48,5 +48,5 @@
 
         protected:
-            void getConnectedClients();
+//             void getConnectedClients();
     };
 }
Index: de/branches/network6/src/libraries/network/ClientInformation.cc
===================================================================
--- /code/branches/network6/src/libraries/network/ClientInformation.cc	(revision 7822)
+++ 	(revision )
@@ -1,251 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      ...
- *   Co-authors:
- *      ...
- *
- */
-
-//
-// C++ Implementation: ClientInformation
-//
-// Description:
-//
-//
-// Author:  <>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#include "ClientInformation.h"
-#define WIN32_LEAN_AND_MEAN
-#include <enet/enet.h>
-#include "ClientConnectionListener.h"
-
-namespace orxonox
-{
-
-
-  ClientInformation *ClientInformation::head_=0;
-
-  ClientInformation::ClientInformation() {
-    if(!head_)
-      head_=this;
-    gamestateID_=GAMESTATEID_INITIAL;
-    preve=0;
-    nexte=0;
-    synched_=false;
-  }
-
-  ClientInformation::~ClientInformation() {
-    if(prev()!=0)
-      prev()->setNext(this->next());
-    if(next()!=0)
-      next()->setPrev(this->prev());
-    if(this==head_)
-      head_=next();
-    ClientConnectionListener::broadcastClientDisconnected( this->getID() );
-  }
-
-  ClientInformation *ClientInformation::next() {
-    if(this!=0)
-      return this->nexte;
-    else
-      return 0;
-  }
-  ClientInformation *ClientInformation::prev() {
-    if(this!=0)
-      return this->preve;
-    else
-      return 0;
-  }
-
-  bool ClientInformation::setPrev(ClientInformation *prev) {
-    if(this==head_)
-      head_=prev;
-    this->preve = prev;
-    return true;
-  }
-
-  bool ClientInformation::setNext(ClientInformation *next) {
-    this->nexte = next;
-    return true;
-  }
-
-  ClientInformation *ClientInformation::insertAfter(ClientInformation *ins) {
-    this->next()->setPrev(ins);
-    ins->setNext(this->next());
-    ins->setPrev(this);
-    this->nexte = ins;
-    return ins;
-  }
-
-  ClientInformation *ClientInformation::insertBefore(ClientInformation *ins){
-    if(!this)
-      return NULL;
-    this->prev()->setNext(ins);
-    ins->setPrev(this->prev());
-    this->preve=ins;
-    ins->setNext(this);
-    return ins;
-  }
-
-  void ClientInformation::setID(int clientID){
-    if(!this)
-      return;
-    clientID_ = clientID;
-  }
-
-  bool ClientInformation::setPeer(ENetPeer *peer){
-    if(!this)
-      return false;
-    peer_ = peer;
-    return true;
-  }
-
-  bool ClientInformation::setGamestateID(int id){
-    if(!this)
-      return false;
-    gamestateID_=id;
-    return true;
-  }
-
-  unsigned int ClientInformation::getID() {
-    if(!this)
-      return CLIENTID_UNKNOWN;
-    else
-      return clientID_;
-  }
-
-  ENetPeer *ClientInformation::getPeer() {
-    if(this)
-      return peer_;
-    else
-      return NULL;
-  }
-
-  uint32_t ClientInformation::getRTT(){
-    return this->peer_->roundTripTime;
-  }
-
-  double ClientInformation::getPacketLoss(){
-    return static_cast<double>(this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE;
-  }
-
-  unsigned int ClientInformation::getGamestateID() {
-    if(this)
-      return gamestateID_;
-    else
-      return static_cast<unsigned int>(-1);
-  }
-
-  ClientInformation *ClientInformation::insertBack(ClientInformation *ins) {
-    ClientInformation *temp = head_;
-    if(temp==ins){
-      return head_;
-    }
-    while(temp->next()!=0){
-      temp = temp->next();
-    }
-    temp->setNext(ins);
-    ins->setPrev(temp);
-    return ins;
-  }
-
-  bool ClientInformation::removeClient(unsigned int clientID) {
-    if(clientID==CLIENTID_UNKNOWN)
-      return false;
-    ClientInformation *temp = head_;
-    while(temp!=0 && temp->getID()!=clientID)
-      temp = temp->next();
-    if(temp==0)
-      return false;
-    delete temp;
-    return true;
-  }
-
-  bool ClientInformation::removeClient(ENetPeer *peer) {
-    if(!peer)
-      return false;
-    ClientInformation *temp = head_;
-    while(temp!=0){
-      if(!memcmp(& temp->getPeer()->address, & peer->address, sizeof(peer->address)))
-        break;
-      temp = temp->next();
-    }
-    if(temp==0)
-      return false;
-    delete temp;
-    return true;
-  }
-
-  /**
-  * This function goes forward through the list and looks for an element with clientID
-  * This function should only be applied to the head of the list
-  * @param clientID id to look for
-  * @param look_backwards FIXME - add doc? parameter unused?
-  * @return pointer to the last element in the list or 0 if the search was unsuccessfull
-  */
-  ClientInformation *ClientInformation::findClient(unsigned int clientID, bool look_backwards) {
-    ClientInformation *temp = head_;
-    while(temp!=0 && temp->getID()!=clientID){
-      temp = temp->next();
-    }
-    // returns 0 if nothing has been found
-    return temp;
-  }
-
-  /**
-  * This function goes forward through the list and looks for an element with clientID
-  * This function should only be applied to the head of the list
-  * @param address peer to look for
-  * @param look_backwards FIXME - add doc? parameter unused?
-  * @return pointer to the element in the list
-  */
-  ClientInformation *ClientInformation::findClient(ENetAddress *address, bool look_backwards) {
-    ClientInformation *temp = head_;
-    while(temp!=0){
-      if(!memcmp(& temp->getPeer()->address, address, sizeof(*address)))
-        break;
-      temp = temp->next();
-    }
-    // returns 0 if nothing has been found
-    return temp;
-  }
-
-  bool ClientInformation::setSynched(bool s) {
-    if(!this)
-      return false;
-    synched_=s;
-    return true;
-  }
-
-  bool ClientInformation::getSynched() {
-    if(this)
-      return synched_;
-    else
-      return false;
-  }
-
-}
Index: de/branches/network6/src/libraries/network/ClientInformation.h
===================================================================
--- /code/branches/network6/src/libraries/network/ClientInformation.h	(revision 7822)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      ...
- *   Co-authors:
- *      ...
- *
- */
-
-//
-// C++ Interface: ClientInformation
-//
-// Description:
-//
-//
-// Author:  <>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-#ifndef _ClientInformation_H__
-#define _ClientInformation_H__
-
-#include "NetworkPrereqs.h"
-
-// WATCH OUT: THE CLIENTINFORMATION LIST IS NOT THREADSAFE ANYMORE
-
-namespace orxonox
-{
-
-  /**
-  * This class implements a list for client information
-  * @author Oliver Scheuss
-  */
-  class _NetworkExport ClientInformation{
-  public:
-    ClientInformation();
-    //   ClientInformation(ClientInformation *prev, ClientInformation *next);
-    //   ClientInformation(ClientInformation *prev);
-    ~ClientInformation();
-    ClientInformation *next();
-    ClientInformation *prev();
-    static ClientInformation *insertBack(ClientInformation *ins);
-
-    // set functions
-    void setID(int clientID);
-    bool setPeer(ENetPeer *peer);
-    bool setGamestateID(int id);
-    inline void setShipID(unsigned int id){ShipID_=id;}
-
-    // get functions
-    inline unsigned int getShipID(){return ShipID_;}
-    unsigned int getID();
-    unsigned int getGamestateID();
-    ENetPeer *getPeer();
-
-    uint32_t getRTT();
-    double getPacketLoss();
-
-    static bool removeClient(unsigned int clientID);
-    static bool removeClient(ENetPeer *peer);
-    static ClientInformation *findClient(unsigned int clientID, bool look_backwards=false);
-    static ClientInformation *findClient(ENetAddress *address, bool look_backwards=false);
-    static ClientInformation *getBegin(){return head_;}
-    static bool hasClients(){ return ClientInformation::head_!=0; }
-
-    bool setSynched(bool s);
-    bool getSynched();
-
-  private:
-    static ClientInformation *head_;
-
-    bool setNext(ClientInformation *next);
-    bool setPrev(ClientInformation *prev);
-    ClientInformation *insertAfter(ClientInformation *ins);
-    ClientInformation *insertBefore(ClientInformation *ins);
-
-    ClientInformation *preve;
-    ClientInformation *nexte;
-    //actual information:
-    ENetPeer *peer_;
-    unsigned int clientID_;
-    unsigned int gamestateID_;
-    unsigned int ShipID_;   // this is the unique objectID
-    bool synched_;
-
-  };
-
-}
-
-#endif /* _ClientInformation_H__ */
Index: /code/branches/network6/src/libraries/network/Connection.cc
===================================================================
--- /code/branches/network6/src/libraries/network/Connection.cc	(revision 7822)
+++ /code/branches/network6/src/libraries/network/Connection.cc	(revision 7823)
@@ -44,5 +44,5 @@
 
   Connection::Connection():
-    host_(0), bCommunicationThreadRunning_(false)
+    host_(0), bCommunicationThreadRunning_(false), nextPeerID_(NETWORK_PEER_ID_SERVER+1)
   {
     enet_initialize();
@@ -75,13 +75,7 @@
   }
 
-
-//   int Connection::service(ENetEvent* event) {
-//     return enet_host_service( this->host_, event, NETWORK_WAIT_TIMEOUT );
-//   }
-
-  void Connection::disconnectPeer(ENetPeer *peer)
-  {
-    assert(peer);
-    outgoingEvent outEvent = { peer, outgoingEventType::disconnectPeer, (ENetPacket*)10, 15 };
+  void Connection::disconnectPeer(uint32_t peerID)
+  {
+    outgoingEvent outEvent = { peerID, outgoingEventType::disconnectPeer, 0, 0 };
     
     this->outgoingEventsMutex_->lock();
@@ -89,9 +83,8 @@
     this->outgoingEventsMutex_->unlock();
   }
-
-  void Connection::addPacket(ENetPacket *packet, ENetPeer *peer, uint8_t channelID)
-  {
-    assert(peer);
-    outgoingEvent outEvent = { peer, outgoingEventType::sendPacket, packet, channelID };
+  
+  void Connection::disconnectPeers()
+  {
+    outgoingEvent outEvent = { 0, outgoingEventType::disconnectPeers, 0, 0 };
     
     this->outgoingEventsMutex_->lock();
@@ -99,8 +92,8 @@
     this->outgoingEventsMutex_->unlock();
   }
-  
-  void Connection::broadcastPacket(ENetPacket* packet, uint8_t channelID)
-  {
-    outgoingEvent outEvent = { (ENetPeer*)15, outgoingEventType::broadcastPacket, packet, channelID };
+
+  void Connection::addPacket(ENetPacket* packet, uint32_t peerID, uint8_t channelID)
+  {
+    outgoingEvent outEvent = { peerID, outgoingEventType::sendPacket, packet, channelID };
     
     this->outgoingEventsMutex_->lock();
@@ -108,4 +101,13 @@
     this->outgoingEventsMutex_->unlock();
   }
+  
+  void Connection::broadcastPacket(ENetPacket* packet, uint8_t channelID)
+  {
+    outgoingEvent outEvent = { 0, outgoingEventType::broadcastPacket, packet, channelID };
+    
+    this->outgoingEventsMutex_->lock();
+    this->outgoingEvents_.push_back(outEvent);
+    this->outgoingEventsMutex_->unlock();
+  }
 
   
@@ -119,9 +121,5 @@
       while( enet_host_check_events( this->host_, &event ) > 0 )
       {
-//         COUT(0) << "incoming event" << endl;
-        // received an event
-        this->incomingEventsMutex_->lock();
-        this->incomingEvents_.push_back(event);
-        this->incomingEventsMutex_->unlock();
+        processIncomingEvent(event);
       }
       
@@ -138,18 +136,6 @@
         this->outgoingEventsMutex_->unlock();
         
-        switch( outEvent.type )
-        {
-          case outgoingEventType::sendPacket:
-            enet_peer_send( outEvent.peer, outEvent.channelID, outEvent.packet );
-            break;
-          case outgoingEventType::disconnectPeer:
-            enet_peer_disconnect(outEvent.peer, 0);
-            break;
-          case outgoingEventType::broadcastPacket:
-            enet_host_broadcast( this->host_, outEvent.channelID, outEvent.packet );
-            break;
-          default:
-            assert(0);
-        }
+        processOutgoingEvent(outEvent);
+        
         this->outgoingEventsMutex_->lock();
         outgoingEventsCount = this->outgoingEvents_.size();
@@ -160,16 +146,69 @@
       if( enet_host_service( this->host_, &event, NETWORK_WAIT_TIMEOUT ) > 0 )
       {
-//         COUT(0) << "incoming event after wait" << endl;
-        //received an event
-        this->incomingEventsMutex_->lock();
-        this->incomingEvents_.push_back(event);
-        this->incomingEventsMutex_->unlock();
+        processIncomingEvent(event);
       }
     }
   }
+  
+  void Connection::processIncomingEvent(ENetEvent& event)
+  {
+    incomingEvent inEvent;
+    // preprocess event
+    switch( event.type )
+    {
+      case ENET_EVENT_TYPE_CONNECT:
+        inEvent = preprocessConnectEvent(event);
+        break;
+      case ENET_EVENT_TYPE_RECEIVE:
+        inEvent = preprocessReceiveEvent(event);
+        break;
+      case ENET_EVENT_TYPE_DISCONNECT:
+        inEvent = preprocessDisconnectEvent(event);
+        break;
+      case ENET_EVENT_TYPE_NONE:
+      default:
+        return;
+    }
+    
+    // pushing event to queue
+    this->incomingEventsMutex_->lock();
+    this->incomingEvents_.push_back(inEvent);
+    this->incomingEventsMutex_->unlock();
+  }
+  
+  void Connection::processOutgoingEvent(outgoingEvent& event)
+  {
+    ENetPeer* peer;
+    switch( event.type )
+    {
+      case outgoingEventType::sendPacket:
+        assert(this->peerMap_.find(event.peerID) != this->peerMap_.end());
+        peer = this->peerMap_[event.peerID];
+        enet_peer_send( peer, event.channelID, event.packet );
+        break;
+      case outgoingEventType::disconnectPeer:
+        assert(this->peerMap_.find(event.peerID) != this->peerMap_.end());
+        peer = this->peerMap_[event.peerID];
+        enet_peer_disconnect(peer, 0);
+        break;
+      case outgoingEventType::disconnectPeers:
+        while( this->peerMap_.size()!=0 )
+        {
+          peer = this->peerMap_.begin()->second;
+          enet_peer_disconnect(peer, 0);
+        }
+        break;
+      case outgoingEventType::broadcastPacket:
+        enet_host_broadcast( this->host_, event.channelID, event.packet );
+        break;
+      default:
+        assert(0);
+    }
+  }
+
 
   void Connection::processQueue()
   {
-    ENetEvent event;
+    incomingEvent inEvent;
 
     this->incomingEventsMutex_->lock();
@@ -178,28 +217,27 @@
     while( incomingEventsCount > 0 )
     {
-      packet::Packet* p;
+      // pop event from queue
       this->incomingEventsMutex_->lock();
-      event = this->incomingEvents_.front();
+      inEvent = this->incomingEvents_.front();
       this->incomingEvents_.pop_front();
       this->incomingEventsMutex_->unlock();
       
-      switch(event.type)
+      // process event
+      switch( inEvent.type )
       {
-        // log handling ================
-        case ENET_EVENT_TYPE_CONNECT:
-          addPeer( &event );
+        case incomingEventType::peerConnect:
+          addPeer(inEvent.peerID);
           break;
-        case ENET_EVENT_TYPE_DISCONNECT:
-          removePeer( &event );
+        case incomingEventType::peerDisconnect:
+          removePeer(inEvent.peerID);
           break;
-        case ENET_EVENT_TYPE_RECEIVE:
-//           COUT(0) << "ENET_EVENT_TYPE_RECEIVE" << endl;
-          p = createPacket( &event );
-          processPacket(p);
+        case incomingEventType::receivePacket:
+          processPacket(inEvent.packet);
           break;
-        case ENET_EVENT_TYPE_NONE:
+        default:
           break;
       }
       
+      // check whether there are still events in the queue
       this->incomingEventsMutex_->lock();
       incomingEventsCount = this->incomingEvents_.size();
@@ -208,10 +246,52 @@
   }
 
-  packet::Packet* Connection::createPacket(ENetEvent* event)
-  {
-    packet::Packet *p = packet::Packet::createPacket(event->packet, event->peer);
-    return p;
-//     return p->process();
-  }
+  incomingEvent Connection::preprocessConnectEvent(ENetEvent& event)
+  {
+    // make sure this peer doesn't exist
+    assert( this->peerMap_.find(this->nextPeerID_) == this->peerMap_.end() );
+    assert( this->peerIDMap_.find(event.peer) == this->peerIDMap_.end() );
+    
+    // give peer a new id and increase peerID for next peer
+    uint32_t peerID = this->nextPeerID_;
+    ++this->nextPeerID_;
+    
+    // add peer/peerID into peerMap_ and peerIDMap_
+    this->peerMap_[peerID] = event.peer;
+    this->peerIDMap_[event.peer] = peerID;
+    
+    // create new peerEvent and return it
+    incomingEvent inEvent = { peerID, incomingEventType::peerConnect, 0 };
+    return inEvent;
+  }
+  
+  incomingEvent Connection::preprocessDisconnectEvent(ENetEvent& event)
+  {
+    // assert that the peer exists and get peerID
+    assert( this->peerIDMap_.find(event.peer) != this->peerIDMap_.end() );
+    uint32_t peerID = this->peerIDMap_[event.peer];
+    
+    // remove peer/peerID from maps
+    this->peerIDMap_.erase(this->peerIDMap_.find(event.peer));
+    this->peerMap_.erase(this->peerMap_.find(peerID));
+    
+    // create new peerEvent and return it
+    incomingEvent inEvent = { peerID, incomingEventType::peerDisconnect, 0 };
+    return inEvent;
+  }
+  
+  incomingEvent Connection::preprocessReceiveEvent(ENetEvent& event)
+  {
+    // assert that the peer exists and get peerID
+    assert( this->peerIDMap_.find(event.peer) != this->peerIDMap_.end() );
+    uint32_t peerID = this->peerIDMap_[event.peer];
+    
+    // create new Packet from ENetPacket
+    packet::Packet* p = packet::Packet::createPacket(event.packet, peerID);
+    
+    // create new peerEvent and return it
+    incomingEvent inEvent = { peerID, incomingEventType::receivePacket, p };
+    return inEvent;
+  }
+
   
   void Connection::enableCompression()
Index: /code/branches/network6/src/libraries/network/Connection.h
===================================================================
--- /code/branches/network6/src/libraries/network/Connection.h	(revision 7822)
+++ /code/branches/network6/src/libraries/network/Connection.h	(revision 7823)
@@ -44,5 +44,7 @@
 
 #include <deque>
+#include <map>
 #include <enet/enet.h>
+#include <boost/concept_check.hpp>
 
 namespace boost
@@ -59,18 +61,37 @@
   const unsigned int NETWORK_MAX_QUEUE_PROCESS_TIME = 5;
   
+  namespace incomingEventType
+  {
+    enum Value
+    {
+      receivePacket   = 1,  // incoming packet
+      peerConnect     = 2,  // incoming connect request
+      peerDisconnect  = 3   // incoming disconnect request
+    };
+    
+  }
+  
   namespace outgoingEventType
   {
     enum Value
     {
-      sendPacket      = 1,
-      disconnectPeer  = 2,
-      broadcastPacket = 3
+      sendPacket      = 1,  // outgoing packet
+      broadcastPacket = 2,  // outgoing broadcast packet
+      disconnectPeer  = 3,  // outgoing disconnect request
+      disconnectPeers = 4   // outgoing disconnect request
     };
     
   }
   
+  struct _NetworkExport incomingEvent
+  {
+    uint32_t                  peerID;
+    incomingEventType::Value  type;
+    packet::Packet*           packet;
+  };
+  
   struct _NetworkExport outgoingEvent
   {
-    ENetPeer*                 peer;
+    uint32_t                  peerID;
     outgoingEventType::Value  type;
     ENetPacket*               packet;
@@ -83,35 +104,43 @@
     virtual ~Connection();
 
-    void addPacket(ENetPacket *packet, ENetPeer *peer, uint8_t channelID);
-    void broadcastPacket(ENetPacket* packet, uint8_t channelID);
-//     ENetHost* getHost(){ return this->host_; }
-
   protected:
     Connection();
-//     static Connection* getInstance(){ return Connection::instance_; }
-
-//     int service(ENetEvent* event);
+    
     void startCommunicationThread();
     void stopCommunicationThread();
-    void communicationThread();
-    virtual void disconnectPeer(ENetPeer *peer);
+    
+    void addPacket(ENetPacket *packet, uint32_t peerID, uint8_t channelID);
+    void broadcastPacket(ENetPacket* packet, uint8_t channelID);
+    void disconnectPeer(uint32_t peerID);
+    void disconnectPeers();
     
     void enableCompression();
 
     void processQueue();
-    virtual void addPeer(ENetEvent* event)=0;
-    virtual void removePeer(ENetEvent* event)=0;
+    virtual void addPeer(uint32_t peerID)=0;
+    virtual void removePeer(uint32_t peerID)=0;
     virtual void processPacket( packet::Packet* packet)=0;
-    virtual packet::Packet* createPacket(ENetEvent* event);
+    
+    incomingEvent preprocessConnectEvent(ENetEvent& event);
+    incomingEvent preprocessDisconnectEvent(ENetEvent& event);
+    incomingEvent preprocessReceiveEvent(ENetEvent& event);
+    
+    void processIncomingEvent(ENetEvent& event);
+    void processOutgoingEvent(outgoingEvent& event);
 
-    ENetHost*                   host_;
+    ENetHost*                     host_;
   private:
-    boost::thread*              communicationThread_;
-    bool                        bCommunicationThreadRunning_;
-    ENetAddress*                bindAddress_;
-    std::deque<ENetEvent>       incomingEvents_;
-    std::deque<outgoingEvent>   outgoingEvents_;
-    boost::mutex*               incomingEventsMutex_;
-    boost::mutex*               outgoingEventsMutex_;
+    void communicationThread();
+    
+    boost::thread*                communicationThread_;
+    bool                          bCommunicationThreadRunning_;
+    ENetAddress*                  bindAddress_;
+    std::deque<incomingEvent>     incomingEvents_;
+    std::deque<outgoingEvent>     outgoingEvents_;
+    boost::mutex*                 incomingEventsMutex_;
+    boost::mutex*                 outgoingEventsMutex_;
+    std::map<uint32_t, ENetPeer*> peerMap_;
+    std::map<ENetPeer*, uint32_t> peerIDMap_;
+    uint32_t                      nextPeerID_;
 
 //     static Connection *instance_;
Index: de/branches/network6/src/libraries/network/GamestateClient.cc
===================================================================
--- /code/branches/network6/src/libraries/network/GamestateClient.cc	(revision 7822)
+++ 	(revision )
@@ -1,211 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Oliver Scheuss
- *   Co-authors:
- *      Dumeni Manatschal
- *
- */
-
-#include "GamestateClient.h"
-
-#include "util/Debug.h"
-#include "core/ObjectList.h"
-#include "synchronisable/Synchronisable.h"
-#include "synchronisable/NetworkCallbackManager.h"
-#include "packet/Acknowledgement.h"
-#include "packet/Gamestate.h"
-
-
-namespace orxonox
-{
-  struct _NetworkExport GameStateItem
-  {
-    packet::Gamestate *state;
-    unsigned int id;
-  };
-
-  GamestateClient::GamestateClient()
-  {
-    COUT(5) << "this: " << this << std::endl;
-    lastAckedGamestateID_=GAMESTATEID_INITIAL-1;
-    lastProcessedGamestateID_=GAMESTATEID_INITIAL-1;
-    tempGamestate_=NULL;
-  }
-
-  GamestateClient::~GamestateClient()
-  {
-      std::map<unsigned int, packet::Gamestate *>::iterator it;
-      for ( it = this->gamestateMap_.begin(); it != this->gamestateMap_.end(); ++it )
-          delete it->second;
-      if( this->tempGamestate_ )
-          delete this->tempGamestate_;
-  }
-
-  bool GamestateClient::ackGamestate(unsigned int gamestateID, unsigned int clientID)
-  {
-    return true;
-  }
-
-  bool GamestateClient::addGamestate(packet::Gamestate *gs, unsigned int clientID)
-  {
-    if(tempGamestate_!=NULL)
-    {
-      //delete the obsolete gamestate
-      if(tempGamestate_->getID()>gs->getID())
-        return false;
-      delete tempGamestate_;
-    }
-    tempGamestate_=gs;
-    return true;
-  }
-
-  bool GamestateClient::processGamestates()
-  {
-    if(tempGamestate_==NULL)
-      return false;
-    bool isDiffed = tempGamestate_->isDiffed();
-    int id = GAMESTATEID_INITIAL;
-    packet::Gamestate *processed = processGamestate(tempGamestate_);
-    assert(processed);
-
-    //now call the queued callbacks
-    NetworkCallbackManager::callCallbacks();
-
-    if (!processed)
-    {
-      assert(0);
-      sendAck(0);
-      return false;
-    }
-    //successfully loaded data from gamestate. now save gamestate for diff and delete the old gs
-    tempGamestate_=NULL;
-    gamestateMap_[processed->getID()]=processed;
-    lastProcessedGamestateID_ = processed->getID();
-    if(isDiffed)
-      lastAckedGamestateID_ = processed->getBaseID();
-    id = processed->getID();
-    sendAck(id);
-    return true;
-  }
-
-
-  /**
-  * This function removes a Synchronisable out of the universe
-  * @param it iterator of the list pointing to the object
-  * @return iterator pointing to the next object in the list
-  */
-  void GamestateClient::removeObject(ObjectListIterator<Synchronisable> &it)
-  {
-    ObjectListIterator<Synchronisable> temp=it;
-    ++it;
-    temp->destroy(); // or delete?
-  }
-
-  packet::Gamestate *GamestateClient::getGamestate()
-  {
-    packet::Gamestate *gs = new packet::Gamestate();
-    if(!gs->collectData(this->getLastProcessedGamestateID(NETWORK_PEER_ID_SERVER), 0x2))
-    {
-      delete gs;
-      return 0;
-    }
-    return gs;
-  }
-
-  void GamestateClient::cleanup()
-  {
-    std::map<unsigned int, packet::Gamestate*>::iterator temp, it = gamestateMap_.begin();
-    while(it!=gamestateMap_.end())
-    {
-      if(it->first>=lastAckedGamestateID_)
-        break;
-      // otherwise delete that stuff
-      delete it->second;
-      temp=it++;
-      gamestateMap_.erase(temp);
-    }
-    tempGamestate_=NULL;
-  }
-
-  void GamestateClient::printGamestateMap()
-  {
-    std::map<unsigned int, packet::Gamestate*>::iterator it;
-    COUT(4) << "gamestates: ";
-    for(it=gamestateMap_.begin(); it!=gamestateMap_.end(); it++)
-    {
-      COUT(4) << it->first << ':' << it->second << '|';
-    }
-    COUT(4) << std::endl;
-
-  }
-
-  bool GamestateClient::sendAck(unsigned int gamestateID)
-  {
-    packet::Acknowledgement *ack = new packet::Acknowledgement(gamestateID, 0);
-    if(!ack->send())
-    {
-      COUT(3) << "could not ack gamestate: " << gamestateID << std::endl;
-      return false;
-    }
-    else
-    {
-      COUT(5) << "acked a gamestate: " << gamestateID << std::endl;
-      return true;
-    }
-  }
-
-  packet::Gamestate *GamestateClient::processGamestate(packet::Gamestate *gs)
-  {
-    if(gs->isCompressed())
-    {
-      bool b = gs->decompressData();
-      assert(b);
-    }
-    if(gs->isDiffed())
-    {
-      assert(0);
-//       packet::Gamestate *base = gamestateMap_[gs->getBaseID()];
-//       if(!base)
-//       {
-//         COUT(0) << "could not find base gamestate id: " << gs->getBaseID() << endl;
-//         assert(0);
-//         delete gs;
-//         return 0;
-//       }
-//       packet::Gamestate *undiffed = gs->undiff(base);
-//       delete gs;
-//       gs=undiffed;
-//       COUT(5) << "successfully undiffed gamestate id: " << undiffed->getID() << std::endl;
-    }
-    if(gs->spreadData(0x2))
-      return gs;
-    else
-    {
-      COUT(0) << "could not spread gamestate" << endl;
-      assert(0);
-      return NULL;
-    }
-  }
-
-}
-
Index: de/branches/network6/src/libraries/network/GamestateClient.h
===================================================================
--- /code/branches/network6/src/libraries/network/GamestateClient.h	(revision 7822)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Oliver Scheuss
- *   Co-authors:
- *      Dumeni Manatschal
- *
- */
-
-//
-// C++ Interface: GameStateClient
-//
-// Description:
-//
-//
-// Author:  Oliver Scheuss, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-#ifndef _GamestateClient_H__
-#define _GamestateClient_H__
-
-#include "NetworkPrereqs.h"
-
-#include <map>
-#include "core/CorePrereqs.h"
-#include "GamestateHandler.h"
-
-const unsigned int GAMESTATEID_INITIAL = static_cast<unsigned int>(-1);
-
-namespace orxonox
-{
-  class _NetworkExport GamestateClient: public GamestateHandler
-  {
-  public:
-    GamestateClient();
-    ~GamestateClient();
-
-    virtual bool      addGamestate(packet::Gamestate *gs, unsigned int clientID);
-    virtual bool      ackGamestate(unsigned int gamestateID, unsigned int clientID);
-    virtual uint32_t  getLastProcessedGamestateID(unsigned int clientID=0) { return this->lastProcessedGamestateID_; }
-    virtual uint32_t  getCurrentGamestateID(){ return this->lastProcessedGamestateID_; }
-
-    bool processGamestates();
-    packet::Gamestate *getGamestate();
-    void cleanup();
-  private:
-    packet::Gamestate *processGamestate(packet::Gamestate *gs);
-    void removeObject(ObjectListIterator<Synchronisable> &it);
-    void printGamestateMap();
-    bool sendAck(unsigned int gamestateID);
-
-    unsigned int           lastAckedGamestateID_;
-    unsigned int           lastProcessedGamestateID_;
-    std::map<unsigned int, packet::Gamestate *> gamestateMap_;
-    packet::Gamestate *tempGamestate_; // we save the received gamestates here during processQueue
-
-  };
-
-}
-
-#endif /* _GamestateClient_H__ */
Index: /code/branches/network6/src/libraries/network/GamestateManager.h
===================================================================
--- /code/branches/network6/src/libraries/network/GamestateManager.h	(revision 7822)
+++ /code/branches/network6/src/libraries/network/GamestateManager.h	(revision 7823)
@@ -101,4 +101,5 @@
       { assert(peerMap_.find(peerID)!=peerMap_.end()); peerMap_[peerID].isSynched = true; }
     void removePeer( uint32_t peerID );
+    bool hasPeers(){ return this->peerMap_.size()!=0; }
 //     void removeClient(ClientInformation *client);
   protected:
Index: /code/branches/network6/src/libraries/network/Host.cc
===================================================================
--- /code/branches/network6/src/libraries/network/Host.cc	(revision 7822)
+++ /code/branches/network6/src/libraries/network/Host.cc	(revision 7823)
@@ -115,5 +115,5 @@
     {
       for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
-        it->incomingChat(message, CLIENTID_UNKNOWN);
+        it->incomingChat(message, NETWORK_PEER_ID_BROADCAST);
       return true;
     }
Index: /code/branches/network6/src/libraries/network/NetworkPrereqs.h
===================================================================
--- /code/branches/network6/src/libraries/network/NetworkPrereqs.h	(revision 7822)
+++ /code/branches/network6/src/libraries/network/NetworkPrereqs.h	(revision 7823)
@@ -65,9 +65,10 @@
 {
   static const unsigned int GAMESTATEID_INITIAL       = static_cast<unsigned int>(-1);
-  static const unsigned int CLIENTID_UNKNOWN          = static_cast<unsigned int>(-2);
   extern const char* LAN_DISCOVERY_MESSAGE;
   extern const char* LAN_DISCOVERY_ACK;
   static const unsigned int LAN_DISCOVERY_PORT          = 55558;
   static const unsigned int NETWORK_PEER_ID_SERVER      = 0;
+  static const unsigned int NETWORK_PEER_ID_BROADCAST   = static_cast<unsigned int>(-1);
+  static const unsigned int NETWORK_PEER_ID_UNKNOWN     = static_cast<unsigned int>(-2);
   static const unsigned int NETWORK_CHANNEL_DEFAULT     = 0;
   static const unsigned int NETWORK_CHANNEL_UNRELIABLE  = 1;
Index: /code/branches/network6/src/libraries/network/Server.cc
===================================================================
--- /code/branches/network6/src/libraries/network/Server.cc	(revision 7822)
+++ /code/branches/network6/src/libraries/network/Server.cc	(revision 7823)
@@ -57,5 +57,5 @@
 #include "packet/Welcome.h"
 #include "ChatListener.h"
-#include "ClientInformation.h"
+// #include "ClientInformation.h"
 #include "FunctionCallManager.h"
 #include "GamestateManager.h"
@@ -152,13 +152,13 @@
   bool Server::processChat(const std::string& message, unsigned int playerID)
   {
-    ClientInformation *temp = ClientInformation::getBegin();
+//     ClientInformation *temp = ClientInformation::getBegin();
     packet::Chat *chat;
-    while(temp){
-      chat = new packet::Chat(message, playerID);
-      chat->setPeerID(temp->getID());
-      if(!chat->send( static_cast<Host*>(this) ))
-        COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
-      temp = temp->next();
-    }
+//     while(temp){
+    chat = new packet::Chat(message, playerID);
+    chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
+    chat->send( static_cast<Host*>(this) );
+//         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
+//       temp = temp->next();
+//     }
 //    COUT(1) << "Player " << playerID << ": " << message << std::endl;
     return true;
@@ -207,5 +207,5 @@
     //helper_HandleMasterServerRequests();
 
-    if ( ClientInformation::hasClients() )
+    if ( GamestateManager::hasPeers() )
     {
       // process incoming gamestates
@@ -237,12 +237,14 @@
   unsigned int Server::getRTT(unsigned int clientID)
   {
-    assert(ClientInformation::findClient(clientID));
-    return ClientInformation::findClient(clientID)->getRTT();
+//     assert(ClientInformation::findClient(clientID));
+//     return ClientInformation::findClient(clientID)->getRTT();
+    // TODO: reimplement
+    return 0;
   }
 
   void Server::printRTT()
   {
-    for( ClientInformation* temp=ClientInformation::getBegin(); temp!=0; temp=temp->next() )
-      COUT(0) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
+//     for( ClientInformation* temp=ClientInformation::getBegin(); temp!=0; temp=temp->next() )
+//       COUT(0) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
   }
 
@@ -252,6 +254,7 @@
   double Server::getPacketLoss(unsigned int clientID)
   {
-    assert(ClientInformation::findClient(clientID));
-    return ClientInformation::findClient(clientID)->getPacketLoss();
+//     assert(ClientInformation::findClient(clientID));
+//     return ClientInformation::findClient(clientID)->getPacketLoss();
+    return 0.;
   }
 
@@ -261,5 +264,5 @@
   void Server::updateGamestate()
   {
-    if( ClientInformation::getBegin()==NULL )
+    if( this->clientIDs_.size()==0 )
       //no client connected
       return;
@@ -291,7 +294,8 @@
   bool Server::sendObjectDeletes()
   {
-    ClientInformation *temp = ClientInformation::getBegin();
-    if( temp == NULL )
+//     ClientInformation *temp = ClientInformation::getBegin();
+//     if( temp == NULL )
       //no client connected
+    if( this->clientIDs_.size()==0 )
       return true;
     packet::DeleteObjects *del = new packet::DeleteObjects();
@@ -302,61 +306,72 @@
     }
 //     COUT(3) << "sending DeleteObjects" << std::endl;
-    while(temp != NULL){
-      if( !(temp->getSynched()) )
-      {
-        COUT(5) << "Server: not sending gamestate" << std::endl;
-        temp=temp->next();
-        continue;
-      }
-      int cid = temp->getID(); //get client id
-      packet::DeleteObjects *cd = new packet::DeleteObjects(*del);
-      assert(cd);
-      cd->setPeerID(cid);
-      if ( !cd->send( static_cast<Host*>(this) ) )
-        COUT(3) << "Server: packet with client id (cid): " << cid << " not sended" << std::endl;
-      temp=temp->next();
+//     while(temp != NULL){
+//       if( !(temp->getSynched()) )
+//       {
+//         COUT(5) << "Server: not sending gamestate" << std::endl;
+//         temp=temp->next();
+//         continue;
+//       }
+//       int cid = temp->getID(); //get client id
+//       packet::DeleteObjects *cd = new packet::DeleteObjects(*del);
+//       assert(cd);
+    del->setPeerID(NETWORK_PEER_ID_BROADCAST);
+    if ( !del->send( static_cast<Host*>(this) ) )
+      COUT(3) << "Server: could not broadcast deleteObjects packet" << std::endl;
+//       temp=temp->next();
       // gs gets automatically deleted by enet callback
-    }
-    delete del;
+//     }
+//     delete del;
     return true;
   }
 
 
-  void Server::addPeer(ENetEvent *event)
-  {
-    static unsigned int newid=1;
-
-    COUT(2) << "Server: adding client" << std::endl;
-    ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
-    if(!temp)
-    {
-      COUT(2) << "Server: could not add client" << std::endl;
-    }
-    temp->setID(newid);
-    temp->setPeer(event->peer);
+  void Server::addPeer(uint32_t peerID)
+  {
+//     static unsigned int newid=1;
+// 
+//     COUT(2) << "Server: adding client" << std::endl;
+//     ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
+//     if(!temp)
+//     {
+//       COUT(2) << "Server: could not add client" << std::endl;
+//     }
+//     temp->setID(newid);
+//     temp->setPeer(event->peer);
 
     // inform all the listeners
-    ClientConnectionListener::broadcastClientConnected(newid);
-    GamestateManager::addPeer(newid);
-
-    ++newid;
-
-    COUT(3) << "Server: added client id: " << temp->getID() << std::endl;
-    createClient(temp->getID());
+    this->clientIDs_.push_back(peerID);
+    ClientConnectionListener::broadcastClientConnected(peerID);
+    GamestateManager::addPeer(peerID);
+
+//     ++newid;
+
+    COUT(3) << "Server: added client id: " << peerID << std::endl;
+    createClient(peerID);
 }
 
-  void Server::removePeer(ENetEvent *event)
+  void Server::removePeer(uint32_t peerID)
   {
     COUT(4) << "removing client from list" << std::endl;
-    ClientInformation *client = ClientInformation::findClient(&event->peer->address);
-    if(!client)
-      return;
-    else
-    {
-      GamestateManager::removePeer(client->getID());
+//     ClientInformation *client = ClientInformation::findClient(&event->peer->address);
+//     if(!client)
+//       return;
+//     else
+//     {
+  std::vector<uint32_t>::iterator it;
+  for( it=this->clientIDs_.begin(); it!=this->clientIDs_.end(); ++it )
+  {
+    if( *it == peerID )
+    {
+      this->clientIDs_.erase(it);
+      break;
+    }
+  }
+  ClientConnectionListener::broadcastClientDisconnected(peerID);
+  GamestateManager::removePeer(peerID);
       //ServerConnection::disconnectClient( client );
       //ClientConnectionListener::broadcastClientDisconnected( client->getID() ); //this is done in ClientInformation now
-      delete client;
-    }
+//       delete client;
+//     }
   }
   
@@ -377,14 +392,14 @@
   bool Server::createClient(int clientID)
   {
-    ClientInformation *temp = ClientInformation::findClient(clientID);
-    if(!temp)
-    {
-      COUT(2) << "Conn.Man. could not create client with id: " << clientID << std::endl;
-      return false;
-    }
-    COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
+//     ClientInformation *temp = ClientInformation::findClient(clientID);
+//     if(!temp)
+//     {
+//       COUT(2) << "Server. could not create client with id: " << clientID << std::endl;
+//       return false;
+//     }
+//     COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
 
     // synchronise class ids
-    syncClassid(temp->getID());
+    syncClassid(clientID);
 
     // now synchronise functionIDs
@@ -394,14 +409,14 @@
     assert(b);
 
-    temp->setSynched(true);
+//     temp->setSynched(true);
     GamestateManager::setSynched(clientID);
     
     COUT(4) << "sending welcome" << std::endl;
-    packet::Welcome *w = new packet::Welcome(temp->getID(), temp->getShipID());
-    w->setPeerID(temp->getID());
+    packet::Welcome *w = new packet::Welcome(clientID, OBJECTID_UNKNOWN);
+    w->setPeerID(clientID);
     b = w->send( static_cast<Host*>(this) );
     assert(b);
     packet::Gamestate *g = new packet::Gamestate();
-    g->setPeerID(temp->getID());
+    g->setPeerID(clientID);
     b = g->collectData(0,packet::GAMESTATE_MODE_SERVER);
     assert(b);
@@ -415,8 +430,8 @@
   }
 
-  void Server::disconnectClient( ClientInformation *client )
-  {
-    ServerConnection::disconnectClient( client );
-    GamestateManager::removePeer(client->getID());
+  void Server::disconnectClient( uint32_t clientID )
+  {
+    ServerConnection::disconnectClient( clientID );
+    GamestateManager::removePeer( clientID );
     // inform all the listeners
     // ClientConnectionListener::broadcastClientDisconnected(client->getID()); // this is done in ClientInformation now
@@ -430,18 +445,18 @@
   bool Server::broadcast(const std::string& message)
   {
-      return this->sendChat(message, CLIENTID_UNKNOWN);
+      return this->sendChat(message, NETWORK_PEER_ID_BROADCAST);
   }
 
   bool Server::sendChat(const std::string& message, unsigned int clientID)
   {
-    ClientInformation *temp = ClientInformation::getBegin();
+//     ClientInformation *temp = ClientInformation::getBegin();
     packet::Chat *chat;
-    while(temp)
+//     while(temp)
     {
       chat = new packet::Chat(message, clientID);
-      chat->setPeerID(temp->getID());
-      if(!chat->send( static_cast<Host*>(this) ))
-        COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
-      temp = temp->next();
+      chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
+      chat->send( static_cast<Host*>(this) );
+//         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
+//       temp = temp->next();
     }
 //    COUT(1) << "Player " << Host::getPlayerID() << ": " << message << std::endl;
Index: /code/branches/network6/src/libraries/network/Server.h
===================================================================
--- /code/branches/network6/src/libraries/network/Server.h	(revision 7822)
+++ /code/branches/network6/src/libraries/network/Server.h	(revision 7823)
@@ -33,4 +33,5 @@
 
 #include <deque>
+#include <vector>
 
 #include "util/UtilPrereqs.h"
@@ -80,10 +81,10 @@
     unsigned int playerID(){return 0;}
 
-    void addPeer(ENetEvent *event);
-    void removePeer(ENetEvent *event);
+    void addPeer(uint32_t peerID);
+    void removePeer(uint32_t peerID);
     void processPacket(packet::Packet* packet);
 
     bool createClient(int clientID);
-    void disconnectClient( ClientInformation *client);
+    void disconnectClient( uint32_t clientID );
     bool sendGameStates();
     bool sendObjectDeletes();
@@ -95,4 +96,5 @@
     float timeSinceLastUpdate_;
     std::deque<packet::Packet*> packetQueue_;
+    std::vector<uint32_t>       clientIDs_;
   };
 
Index: /code/branches/network6/src/libraries/network/ServerConnection.cc
===================================================================
--- /code/branches/network6/src/libraries/network/ServerConnection.cc	(revision 7822)
+++ /code/branches/network6/src/libraries/network/ServerConnection.cc	(revision 7823)
@@ -35,5 +35,5 @@
 
 #include "util/Debug.h"
-#include "ClientInformation.h"
+// #include "ClientInformation.h"
 
 namespace orxonox
@@ -104,5 +104,5 @@
   void ServerConnection::addPacket(ENetPacket *packet, unsigned int clientID, uint8_t channelID)
   {
-    if ( clientID == CLIENTID_UNKNOWN )
+    if ( clientID == NETWORK_PEER_ID_BROADCAST )
     {
       broadcastPacket(packet, channelID);
@@ -110,50 +110,51 @@
     else
     {
-      ClientInformation *temp = ClientInformation::findClient(clientID);
-      if(!temp){
-        COUT(3) << "C.Man: addPacket findClient failed" << std::endl;
-      }
-      Connection::addPacket(packet, temp->getPeer(), channelID);
+//       ClientInformation *temp = ClientInformation::findClient(clientID);
+//       if(!temp){
+//         COUT(3) << "C.Man: addPacket findClient failed" << std::endl;
+//       }
+      Connection::addPacket(packet, clientID, channelID);
     }
   }
 
-  void ServerConnection::disconnectClient(ClientInformation *client)
-  {
-    Connection::disconnectPeer( client->getPeer() );
-  }
+//   void ServerConnection::disconnectClient(ClientInformation *client)
+//   {
+//     Connection::disconnectPeer( client->getPeer() );
+//   }
 
   void ServerConnection::disconnectClient(int clientID)
   {
-    ClientInformation *client = ClientInformation::findClient(clientID);
-    if(client)
-      ServerConnection::disconnectClient(client);
+//     ClientInformation *client = ClientInformation::findClient(clientID);
+//     if(client)
+    ServerConnection::disconnectClient(clientID);
   }
 
   void ServerConnection::disconnectClients()
   {
-    ClientInformation *temp = ClientInformation::getBegin();
-    while(temp!=0)
-    {
-      ServerConnection::disconnectClient( temp );
-      temp = temp->next();
-    }
+    Connection::disconnectPeers();
+//     ClientInformation *temp = ClientInformation::getBegin();
+//     while(temp!=0)
+//     {
+//       ServerConnection::disconnectClient( temp );
+//       temp = temp->next();
+//     }
     return;
   }
 
 
-  int ServerConnection::getClientID(ENetPeer* peer)
-  {
-    return getClientID(&(peer->address));
-  }
+//   int ServerConnection::getClientID(ENetPeer* peer)
+//   {
+//     return getClientID(&(peer->address));
+//   }
 
-  int ServerConnection::getClientID(ENetAddress* address)
-  {
-    return ClientInformation::findClient(address)->getID();
-  }
-
-  ENetPeer *ServerConnection::getClientPeer(int clientID)
-  {
-    return ClientInformation::findClient(clientID)->getPeer();
-  }
+//   int ServerConnection::getClientID(ENetAddress* address)
+//   {
+//     return ClientInformation::findClient(address)->getID();
+//   }
+// 
+//   ENetPeer *ServerConnection::getClientPeer(int clientID)
+//   {
+//     return ClientInformation::findClient(clientID)->getPeer();
+//   }
 
 
Index: /code/branches/network6/src/libraries/network/ServerConnection.h
===================================================================
--- /code/branches/network6/src/libraries/network/ServerConnection.h	(revision 7822)
+++ /code/branches/network6/src/libraries/network/ServerConnection.h	(revision 7823)
@@ -57,5 +57,5 @@
     bool closeListener();
     void addPacket(ENetPacket *packet, unsigned int ID, uint8_t channelID);
-    virtual void disconnectClient(ClientInformation *client);
+//     virtual void disconnectClient(ClientInformation *client);
     void disconnectClient(int clientID);
   protected:
@@ -64,7 +64,7 @@
 
   private:
-    int getClientID(ENetPeer* peer);
-    int getClientID(ENetAddress* address);
-    ENetPeer* getClientPeer(int clientID);
+//     int getClientID(ENetPeer* peer);
+//     int getClientID(ENetAddress* address);
+//     ENetPeer* getClientPeer(int clientID);
 
     ENetAddress* bindAddress_;
Index: /code/branches/network6/src/libraries/network/packet/Packet.cc
===================================================================
--- /code/branches/network6/src/libraries/network/packet/Packet.cc	(revision 7822)
+++ /code/branches/network6/src/libraries/network/packet/Packet.cc	(revision 7823)
@@ -47,5 +47,5 @@
 #include "Welcome.h"
 #include "network/Host.h"
-#include "network/ClientInformation.h"
+// #include "network/ClientInformation.h"
 
 namespace orxonox{
@@ -85,5 +85,6 @@
 
 
-Packet::Packet(const Packet &p){
+Packet::Packet(const Packet &p)
+{
   enetPacket_=p.enetPacket_;
   flags_=p.flags_;
@@ -104,10 +105,13 @@
     That also means destroying the ENetPacket if one exists. There
 */
-Packet::~Packet(){
+Packet::~Packet()
+{
   // Deallocate data_ memory if necessary.
-  if (this->bDataENetAllocated_){
+  if (this->bDataENetAllocated_)
+  {
     // In this case ENet allocated data_ and will destroy it.
   }
-  else if (this->data_) {
+  else if (this->data_)
+  {
     // This destructor was probably called as a consequence of ENet executing our callback.
     // It simply serves us to be able to deallocate the packet content (data_) ourselves since
@@ -119,5 +123,6 @@
   // Note: For the case ENet used the callback to destroy the packet, we have already set
   // enetPacket_ to NULL to avoid destroying it again.
-  if (this->enetPacket_){
+  if (this->enetPacket_)
+  {
     // enetPacket_->data gets destroyed too by ENet if it was allocated by it.
     enet_packet_destroy(enetPacket_);
@@ -125,10 +130,13 @@
 }
 
-bool Packet::send(orxonox::Host* host){
-  if(packetDirection_ != Direction::Outgoing && packetDirection_ != Direction::Bidirectional ){
+bool Packet::send(orxonox::Host* host)
+{
+  if(packetDirection_ != Direction::Outgoing && packetDirection_ != Direction::Bidirectional )
+  {
     assert(0);
     return false;
   }
-  if(!enetPacket_){
+  if(!enetPacket_)
+  {
     if(!data_){
       assert(0);
@@ -175,11 +183,12 @@
 }
 
-Packet *Packet::createPacket(ENetPacket *packet, ENetPeer *peer){
+Packet *Packet::createPacket(ENetPacket* packet, uint32_t peerID)
+{
   uint8_t *data = packet->data;
-  assert(ClientInformation::findClient(&peer->address)->getID() != static_cast<unsigned int>(-2) || !Host::isServer());
-  unsigned int peerID = ClientInformation::findClient(&peer->address)->getID();
+//   assert(ClientInformation::findClient(&peer->address)->getID() != static_cast<unsigned int>(-2) || !Host::isServer());
+//   unsigned int peerID = ClientInformation::findClient(&peer->address)->getID();
   // HACK
-  if( peerID==static_cast<unsigned int>(-2))
-    peerID = NETWORK_PEER_ID_SERVER;
+//   if( peerID==static_cast<unsigned int>(-2))
+//     peerID = NETWORK_PEER_ID_SERVER;
   Packet *p = 0;
 //   COUT(6) << "packet type: " << *(Type::Value *)&data[_PACKETID] << std::endl;
@@ -235,5 +244,6 @@
     data we allocated ourselves.
 */
-void Packet::deletePacket(ENetPacket *enetPacket){
+void Packet::deletePacket(ENetPacket *enetPacket)
+{
   // Get our Packet from a global map with all Packets created in the send() method of Packet.
   Packet::packetMapMutex_.lock();
Index: /code/branches/network6/src/libraries/network/packet/Packet.h
===================================================================
--- /code/branches/network6/src/libraries/network/packet/Packet.h	(revision 7822)
+++ /code/branches/network6/src/libraries/network/packet/Packet.h	(revision 7823)
@@ -32,10 +32,14 @@
 #include <map>
 
-namespace orxonox {
+namespace orxonox
+{
 
-namespace packet{
+namespace packet
+{
 
-namespace Direction{
-  enum Value{
+namespace Direction
+{
+  enum Value
+  {
     Incoming,
     Outgoing,
@@ -43,6 +47,8 @@
   };
 }
-namespace Type{
-  enum Value{
+namespace Type
+{
+  enum Value
+  {
     Acknowledgement,
     Chat,
@@ -59,12 +65,13 @@
     @author Oliver Scheuss <scheusso [at] ee.ethz.ch>
 */
-class _NetworkExport Packet{
+class _NetworkExport Packet
+{
   public:
     Packet(const Packet &p);
     virtual ~Packet();
-    static Packet *createPacket(ENetPacket *packet, ENetPeer *peer);
-    static void deletePacket(ENetPacket *packet);
+    static Packet* createPacket(ENetPacket* packet, uint32_t peerID);
+    static void deletePacket(ENetPacket* packet);
 
-    virtual unsigned char *getData(){ return data_; };
+    virtual unsigned char* getData(){ return data_; };
     virtual unsigned int getSize() const =0;
     virtual bool process(orxonox::Host* host)=0;
Index: /code/branches/network6/src/modules/overlays/hud/ChatOverlay.cc
===================================================================
--- /code/branches/network6/src/modules/overlays/hud/ChatOverlay.cc	(revision 7822)
+++ /code/branches/network6/src/modules/overlays/hud/ChatOverlay.cc	(revision 7823)
@@ -71,5 +71,5 @@
         std::string text;
 
-        if (senderID != CLIENTID_UNKNOWN)
+        if (senderID != NETWORK_PEER_ID_UNKNOWN)
         {
             std::string name = "unknown";
Index: /code/branches/network6/src/orxonox/ChatHistory.cc
===================================================================
--- /code/branches/network6/src/orxonox/ChatHistory.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/ChatHistory.cc	(revision 7823)
@@ -82,5 +82,5 @@
 #ifndef CHATTEST
     /* get sender ID and prepend it to the message */
-    if (senderID != CLIENTID_UNKNOWN)
+    if (senderID != NETWORK_PEER_ID_UNKNOWN)
     {
       /* if we can't find anything, use "unknown" as default */
Index: /code/branches/network6/src/orxonox/ChatInputHandler.cc
===================================================================
--- /code/branches/network6/src/orxonox/ChatInputHandler.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/ChatInputHandler.cc	(revision 7823)
@@ -207,5 +207,5 @@
 
     /* setup player name info */
-    if (senderID != CLIENTID_UNKNOWN)
+    if (senderID != NETWORK_PEER_ID_UNKNOWN)
     {
        PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
Index: /code/branches/network6/src/orxonox/PlayerManager.cc
===================================================================
--- /code/branches/network6/src/orxonox/PlayerManager.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/PlayerManager.cc	(revision 7823)
@@ -45,5 +45,5 @@
         RegisterRootObject(PlayerManager);
 
-        this->getConnectedClients();
+//         this->getConnectedClients();
     }
 
Index: /code/branches/network6/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- /code/branches/network6/src/orxonox/gamestates/GSRoot.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/gamestates/GSRoot.cc	(revision 7823)
@@ -160,5 +160,5 @@
     {
         if (!GameMode::isStandalone())
-            callStaticNetworkFunction(&TimeFactorListener::setTimeFactor, CLIENTID_UNKNOWN, factor_new);
+            callStaticNetworkFunction(&TimeFactorListener::setTimeFactor, NETWORK_PEER_ID_BROADCAST, factor_new);
     }
 }
Index: /code/branches/network6/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- /code/branches/network6/src/orxonox/gametypes/Dynamicmatch.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/gametypes/Dynamicmatch.cc	(revision 7823)
@@ -452,5 +452,5 @@
                     if (!it->first)//in order to catch nullpointer
                         continue;
-                    if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                    if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                         continue;
                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
@@ -467,5 +467,5 @@
                        if (!it->first)//in order to catch nullpointer
                            continue;
-                       if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                       if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                            continue;
                        else if (it->second==chaser)
@@ -501,5 +501,5 @@
                     if (!it->first)//in order to catch nullpointer
                         continue;
-                    if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                    if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                         continue;
                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
@@ -516,5 +516,5 @@
                        if (!it->first)
                            continue;
-                       if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                       if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                            continue;
                        else if (it->second==chaser)
@@ -551,5 +551,5 @@
                     if (!it->first)//in order to catch nullpointer
                         continue;
-                    if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                    if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                         continue;
                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
@@ -566,5 +566,5 @@
                        if (!it->first)
                            continue;
-                       if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                       if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                            continue;
                        else if (it->second==chaser)
@@ -632,5 +632,5 @@
             for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
             {
-                if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                     continue;
                 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
Index: /code/branches/network6/src/orxonox/gametypes/Gametype.cc
===================================================================
--- /code/branches/network6/src/orxonox/gametypes/Gametype.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/gametypes/Gametype.cc	(revision 7823)
@@ -262,7 +262,7 @@
                         it->second.frags_++;
 
-                        if (killer->getPlayer()->getClientID() != CLIENTID_UNKNOWN)
+                        if (killer->getPlayer()->getClientID() != NETWORK_PEER_ID_UNKNOWN)
                             this->gtinfo_->sendKillMessage("You killed " + victim->getPlayer()->getName(), killer->getPlayer()->getClientID());
-                        if (victim->getPlayer()->getClientID() != CLIENTID_UNKNOWN)
+                        if (victim->getPlayer()->getClientID() != NETWORK_PEER_ID_UNKNOWN)
                             this->gtinfo_->sendDeathMessage("You were killed by " + killer->getPlayer()->getName(), victim->getPlayer()->getClientID());
                     }
Index: /code/branches/network6/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- /code/branches/network6/src/orxonox/gametypes/LastManStanding.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/gametypes/LastManStanding.cc	(revision 7823)
@@ -86,5 +86,5 @@
             if (it != this->players_.end())
             {
-                if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
                     return true;
                 const std::string& message = ""; // resets Camper-Warning-message
@@ -131,5 +131,5 @@
         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
         {
-            if (it->first->getClientID() == CLIENTID_UNKNOWN)
+            if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                 continue;
 
@@ -194,5 +194,5 @@
         if (it != this->players_.end())
         {
-            if (it->first->getClientID()== CLIENTID_UNKNOWN)
+            if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
                 return;
             const std::string& message = ""; // resets Camper-Warning-message
@@ -249,5 +249,5 @@
                     this->inGame_[it->first]=true;
 
-                    if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                    if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
                         continue;
                     int output=1+playerDelayTime_[it->first];
@@ -261,5 +261,5 @@
                     {
                         this->punishPlayer(it->first);
-                        if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                        if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
                             return;
                         const std::string& message = ""; // resets Camper-Warning-message
@@ -269,5 +269,5 @@
                 else if (it->second<timeRemaining/5)//Warning message
                 {
-                    if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                    if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
                         continue;
                     const std::string& message = "Camper Warning! Don't forget to shoot.";
Index: /code/branches/network6/src/orxonox/gametypes/TeamBaseMatch.cc
===================================================================
--- /code/branches/network6/src/orxonox/gametypes/TeamBaseMatch.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/gametypes/TeamBaseMatch.cc	(revision 7823)
@@ -190,5 +190,5 @@
             for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
             {
-                if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                     continue;
 
Index: /code/branches/network6/src/orxonox/gametypes/UnderAttack.cc
===================================================================
--- /code/branches/network6/src/orxonox/gametypes/UnderAttack.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/gametypes/UnderAttack.cc	(revision 7823)
@@ -76,5 +76,5 @@
         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
         {
-            if (it->first->getClientID() == CLIENTID_UNKNOWN)
+            if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                 continue;
 
@@ -158,5 +158,5 @@
                 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
                 {
-                    if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                    if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                         continue;
 
Index: /code/branches/network6/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- /code/branches/network6/src/orxonox/infos/GametypeInfo.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/infos/GametypeInfo.cc	(revision 7823)
@@ -74,5 +74,5 @@
         if (GameMode::isMaster())
         {
-            callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), CLIENTID_UNKNOWN, message);
+            callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);
             this->dispatchAnnounceMessage(message);
         }
Index: /code/branches/network6/src/orxonox/infos/HumanPlayer.cc
===================================================================
--- /code/branches/network6/src/orxonox/infos/HumanPlayer.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/infos/HumanPlayer.cc	(revision 7823)
@@ -32,5 +32,5 @@
 #include "core/ConfigValueIncludes.h"
 #include "core/GameMode.h"
-#include "network/ClientInformation.h"
+// #include "network/ClientInformation.h"
 #include "network/Host.h"
 #include "controllers/HumanController.h"
@@ -144,10 +144,12 @@
     float HumanPlayer::getPing() const
     {
-        return static_cast<float>(ClientInformation::findClient(this->getClientID())->getRTT());
+//         return static_cast<float>(ClientInformation::findClient(this->getClientID())->getRTT());
+        return 0.; //TODO: reimplement this
     }
 
     float HumanPlayer::getPacketLossRatio() const
     {
-        return static_cast<float>(ClientInformation::findClient(this->getClientID())->getPacketLoss());
+      //         return static_cast<float>(ClientInformation::findClient(this->getClientID())->getPacketLoss());
+        return 0.; //TODO: reimplement this
     }
 
Index: /code/branches/network6/src/orxonox/infos/PlayerInfo.cc
===================================================================
--- /code/branches/network6/src/orxonox/infos/PlayerInfo.cc	(revision 7822)
+++ /code/branches/network6/src/orxonox/infos/PlayerInfo.cc	(revision 7823)
@@ -32,5 +32,5 @@
 
 #include "core/CoreIncludes.h"
-#include "network/ClientInformation.h"
+// #include "network/ClientInformation.h"
 #include "gametypes/Gametype.h"
 #include "worldentities/ControllableEntity.h"
@@ -43,5 +43,5 @@
         RegisterObject(PlayerInfo);
 
-        this->clientID_ = CLIENTID_UNKNOWN;
+        this->clientID_ = NETWORK_PEER_ID_UNKNOWN;
         this->bHumanPlayer_ = false;
         this->bLocalPlayer_ = false;
