[Orxonox-commit 3129] r7823 - in code/branches/network6/src: libraries/network libraries/network/packet modules/overlays/hud orxonox orxonox/gamestates orxonox/gametypes orxonox/infos

scheusso at orxonox.net scheusso at orxonox.net
Tue Dec 28 16:46:43 CET 2010


Author: scheusso
Date: 2010-12-28 16:46:42 +0100 (Tue, 28 Dec 2010)
New Revision: 7823

Removed:
   code/branches/network6/src/libraries/network/ClientInformation.cc
   code/branches/network6/src/libraries/network/ClientInformation.h
   code/branches/network6/src/libraries/network/GamestateClient.cc
   code/branches/network6/src/libraries/network/GamestateClient.h
Modified:
   code/branches/network6/src/libraries/network/CMakeLists.txt
   code/branches/network6/src/libraries/network/ClientConnection.cc
   code/branches/network6/src/libraries/network/ClientConnection.h
   code/branches/network6/src/libraries/network/ClientConnectionListener.cc
   code/branches/network6/src/libraries/network/ClientConnectionListener.h
   code/branches/network6/src/libraries/network/Connection.cc
   code/branches/network6/src/libraries/network/Connection.h
   code/branches/network6/src/libraries/network/GamestateManager.h
   code/branches/network6/src/libraries/network/Host.cc
   code/branches/network6/src/libraries/network/NetworkPrereqs.h
   code/branches/network6/src/libraries/network/Server.cc
   code/branches/network6/src/libraries/network/Server.h
   code/branches/network6/src/libraries/network/ServerConnection.cc
   code/branches/network6/src/libraries/network/ServerConnection.h
   code/branches/network6/src/libraries/network/packet/Packet.cc
   code/branches/network6/src/libraries/network/packet/Packet.h
   code/branches/network6/src/modules/overlays/hud/ChatOverlay.cc
   code/branches/network6/src/orxonox/ChatHistory.cc
   code/branches/network6/src/orxonox/ChatInputHandler.cc
   code/branches/network6/src/orxonox/PlayerManager.cc
   code/branches/network6/src/orxonox/gamestates/GSRoot.cc
   code/branches/network6/src/orxonox/gametypes/Dynamicmatch.cc
   code/branches/network6/src/orxonox/gametypes/Gametype.cc
   code/branches/network6/src/orxonox/gametypes/LastManStanding.cc
   code/branches/network6/src/orxonox/gametypes/TeamBaseMatch.cc
   code/branches/network6/src/orxonox/gametypes/UnderAttack.cc
   code/branches/network6/src/orxonox/infos/GametypeInfo.cc
   code/branches/network6/src/orxonox/infos/HumanPlayer.cc
   code/branches/network6/src/orxonox/infos/PlayerInfo.cc
Log:
again some structural changes in network to increase modularity/encapsulation
precondition for fixing client-disconnect bug


Modified: code/branches/network6/src/libraries/network/CMakeLists.txt
===================================================================
--- code/branches/network6/src/libraries/network/CMakeLists.txt	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/CMakeLists.txt	2010-12-28 15:46:42 UTC (rev 7823)
@@ -21,7 +21,6 @@
   ChatListener.cc
   Client.cc
   ClientConnection.cc
-  ClientInformation.cc
   ClientConnectionListener.cc
   Connection.cc
   FunctionCall.cc
@@ -49,7 +48,6 @@
   Client.h
   ClientConnection.h
   ClientConnectionListener.h
-  ClientInformation.h
   Connection.h
   FunctionCall.h
   FunctionCallManager.h

Modified: code/branches/network6/src/libraries/network/ClientConnection.cc
===================================================================
--- code/branches/network6/src/libraries/network/ClientConnection.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/ClientConnection.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -102,6 +102,10 @@
     {
       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();
         return true;
@@ -147,14 +151,16 @@
   void ClientConnection::addPacket(ENetPacket *packet, uint8_t channelID) {
     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;
     COUT(1) << "Received disconnect Packet from Server!" << endl;

Modified: code/branches/network6/src/libraries/network/ClientConnection.h
===================================================================
--- code/branches/network6/src/libraries/network/ClientConnection.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/ClientConnection.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -56,8 +56,8 @@
     virtual void connectionClosed()=0;
     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();
     // enet stuff

Modified: code/branches/network6/src/libraries/network/ClientConnectionListener.cc
===================================================================
--- code/branches/network6/src/libraries/network/ClientConnectionListener.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/ClientConnectionListener.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -30,7 +30,7 @@
 
 #include "core/CoreIncludes.h"
 #include "core/GameMode.h"
-#include "ClientInformation.h"
+// #include "ClientInformation.h"
 
 namespace orxonox
 {
@@ -51,15 +51,15 @@
             it->clientDisconnected(clientID);
     }
 
-    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();
+//         }
+//     }
 }
 
 

Modified: code/branches/network6/src/libraries/network/ClientConnectionListener.h
===================================================================
--- code/branches/network6/src/libraries/network/ClientConnectionListener.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/ClientConnectionListener.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -47,7 +47,7 @@
             virtual void clientDisconnected(unsigned int clientID) = 0;
 
         protected:
-            void getConnectedClients();
+//             void getConnectedClients();
     };
 }
 

Deleted: code/branches/network6/src/libraries/network/ClientInformation.cc
===================================================================
--- code/branches/network6/src/libraries/network/ClientInformation.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/ClientInformation.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -1,251 +0,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;
-  }
-
-}

Deleted: code/branches/network6/src/libraries/network/ClientInformation.h
===================================================================
--- code/branches/network6/src/libraries/network/ClientInformation.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/ClientInformation.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -1,110 +0,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__ */

Modified: code/branches/network6/src/libraries/network/Connection.cc
===================================================================
--- code/branches/network6/src/libraries/network/Connection.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/Connection.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -43,7 +43,7 @@
   const boost::posix_time::millisec NETWORK_COMMUNICATION_THREAD_WAIT_TIME(20);
 
   Connection::Connection():
-    host_(0), bCommunicationThreadRunning_(false)
+    host_(0), bCommunicationThreadRunning_(false), nextPeerID_(NETWORK_PEER_ID_SERVER+1)
   {
     enet_initialize();
     atexit(enet_deinitialize);
@@ -74,25 +74,27 @@
     delete this->communicationThread_;
   }
 
-
-//   int Connection::service(ENetEvent* event) {
-//     return enet_host_service( this->host_, event, NETWORK_WAIT_TIMEOUT );
-//   }
-
-  void Connection::disconnectPeer(ENetPeer *peer)
+  void Connection::disconnectPeer(uint32_t peerID)
   {
-    assert(peer);
-    outgoingEvent outEvent = { peer, outgoingEventType::disconnectPeer, (ENetPacket*)10, 15 };
+    outgoingEvent outEvent = { peerID, outgoingEventType::disconnectPeer, 0, 0 };
     
     this->outgoingEventsMutex_->lock();
     this->outgoingEvents_.push_back(outEvent);
     this->outgoingEventsMutex_->unlock();
   }
+  
+  void Connection::disconnectPeers()
+  {
+    outgoingEvent outEvent = { 0, outgoingEventType::disconnectPeers, 0, 0 };
+    
+    this->outgoingEventsMutex_->lock();
+    this->outgoingEvents_.push_back(outEvent);
+    this->outgoingEventsMutex_->unlock();
+  }
 
-  void Connection::addPacket(ENetPacket *packet, ENetPeer *peer, uint8_t channelID)
+  void Connection::addPacket(ENetPacket* packet, uint32_t peerID, uint8_t channelID)
   {
-    assert(peer);
-    outgoingEvent outEvent = { peer, outgoingEventType::sendPacket, packet, channelID };
+    outgoingEvent outEvent = { peerID, outgoingEventType::sendPacket, packet, channelID };
     
     this->outgoingEventsMutex_->lock();
     this->outgoingEvents_.push_back(outEvent);
@@ -101,7 +103,7 @@
   
   void Connection::broadcastPacket(ENetPacket* packet, uint8_t channelID)
   {
-    outgoingEvent outEvent = { (ENetPeer*)15, outgoingEventType::broadcastPacket, packet, channelID };
+    outgoingEvent outEvent = { 0, outgoingEventType::broadcastPacket, packet, channelID };
     
     this->outgoingEventsMutex_->lock();
     this->outgoingEvents_.push_back(outEvent);
@@ -118,11 +120,7 @@
       // Receive all pending incoming Events (such as packets, connects and disconnects)
       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);
       }
       
       // Send all waiting outgoing packets
@@ -137,20 +135,8 @@
         this->outgoingEvents_.pop_front();
         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();
         this->outgoingEventsMutex_->unlock();
@@ -159,61 +145,155 @@
       // Wait for incoming events (at most NETWORK_WAIT_TIMEOUT ms)
       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();
     uint32_t incomingEventsCount = this->incomingEvents_.size();
     this->incomingEventsMutex_->unlock();
     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();
       this->incomingEventsMutex_->unlock();
     }
   }
 
-  packet::Packet* Connection::createPacket(ENetEvent* event)
+  incomingEvent Connection::preprocessConnectEvent(ENetEvent& event)
   {
-    packet::Packet *p = packet::Packet::createPacket(event->packet, event->peer);
-    return p;
-//     return p->process();
+    // 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()
   {
     enet_host_compress_with_range_coder( this->host_ );

Modified: code/branches/network6/src/libraries/network/Connection.h
===================================================================
--- code/branches/network6/src/libraries/network/Connection.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/Connection.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -43,7 +43,9 @@
 #include "NetworkPrereqs.h"
 
 #include <deque>
+#include <map>
 #include <enet/enet.h>
+#include <boost/concept_check.hpp>
 
 namespace boost
 {
@@ -58,20 +60,39 @@
   const unsigned int NETWORK_WAIT_TIMEOUT           = 1;
   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;
     ENetChannelID             channelID;
@@ -82,37 +103,45 @@
   public:
     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_;
 

Deleted: code/branches/network6/src/libraries/network/GamestateClient.cc
===================================================================
--- code/branches/network6/src/libraries/network/GamestateClient.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/GamestateClient.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -1,211 +0,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;
-    }
-  }
-
-}
-

Deleted: code/branches/network6/src/libraries/network/GamestateClient.h
===================================================================
--- code/branches/network6/src/libraries/network/GamestateClient.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/GamestateClient.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -1,82 +0,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__ */

Modified: code/branches/network6/src/libraries/network/GamestateManager.h
===================================================================
--- code/branches/network6/src/libraries/network/GamestateManager.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/GamestateManager.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -100,6 +100,7 @@
     void setSynched( uint32_t peerID )
       { 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:
     virtual bool sendPacket( packet::Packet* packet ) = 0;

Modified: code/branches/network6/src/libraries/network/Host.cc
===================================================================
--- code/branches/network6/src/libraries/network/Host.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/Host.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -114,7 +114,7 @@
     if(instances_s.size()==0)
     {
       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;
     }
     else

Modified: code/branches/network6/src/libraries/network/NetworkPrereqs.h
===================================================================
--- code/branches/network6/src/libraries/network/NetworkPrereqs.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/NetworkPrereqs.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -64,11 +64,12 @@
 namespace orxonox
 {
   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;
   static const unsigned int NETWORK_CHANNEL_COUNT       = 2;

Modified: code/branches/network6/src/libraries/network/Server.cc
===================================================================
--- code/branches/network6/src/libraries/network/Server.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/Server.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -56,7 +56,7 @@
 #include "packet/Gamestate.h"
 #include "packet/Welcome.h"
 #include "ChatListener.h"
-#include "ClientInformation.h"
+// #include "ClientInformation.h"
 #include "FunctionCallManager.h"
 #include "GamestateManager.h"
 #include "WANDiscovery.h"
@@ -151,15 +151,15 @@
 
   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;
   }
@@ -206,7 +206,7 @@
     /* todo */
     //helper_HandleMasterServerRequests();
 
-    if ( ClientInformation::hasClients() )
+    if ( GamestateManager::hasPeers() )
     {
       // process incoming gamestates
       GamestateManager::processGamestates();
@@ -236,14 +236,16 @@
    */
   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;
   }
 
   /**
@@ -251,8 +253,9 @@
    */
   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.;
   }
 
   /**
@@ -260,7 +263,7 @@
   */
   void Server::updateGamestate()
   {
-    if( ClientInformation::getBegin()==NULL )
+    if( this->clientIDs_.size()==0 )
       //no client connected
       return;
     GamestateManager::update();
@@ -290,9 +293,10 @@
 
   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();
     if(!del->fetchIDs())
@@ -301,63 +305,74 @@
       return true;  //everything ok (no deletes this tick)
     }
 //     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)
+  void Server::addPeer(uint32_t peerID)
   {
-    static unsigned int newid=1;
+//     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);
 
-    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);
+    this->clientIDs_.push_back(peerID);
+    ClientConnectionListener::broadcastClientConnected(peerID);
+    GamestateManager::addPeer(peerID);
 
-    ++newid;
+//     ++newid;
 
-    COUT(3) << "Server: added client id: " << temp->getID() << std::endl;
-    createClient(temp->getID());
+    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
+//     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 )
     {
-      GamestateManager::removePeer(client->getID());
+      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;
+//     }
   }
   
   void Server::processPacket(packet::Packet* packet)
@@ -376,16 +391,16 @@
 
   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
     packet::FunctionIDs *fIDs = new packet::FunctionIDs();
@@ -393,16 +408,16 @@
     bool b = fIDs->send( static_cast<Host*>(this) );
     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);
     if(!b)
@@ -414,10 +429,10 @@
     return true;
   }
 
-  void Server::disconnectClient( ClientInformation *client )
+  void Server::disconnectClient( uint32_t clientID )
   {
-    ServerConnection::disconnectClient( client );
-    GamestateManager::removePeer(client->getID());
+    ServerConnection::disconnectClient( clientID );
+    GamestateManager::removePeer( clientID );
     // inform all the listeners
     // ClientConnectionListener::broadcastClientDisconnected(client->getID()); // this is done in ClientInformation now
   }
@@ -429,20 +444,20 @@
 
   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;
     for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)

Modified: code/branches/network6/src/libraries/network/Server.h
===================================================================
--- code/branches/network6/src/libraries/network/Server.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/Server.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -32,6 +32,7 @@
 #include "NetworkPrereqs.h"
 
 #include <deque>
+#include <vector>
 
 #include "util/UtilPrereqs.h"
 #include "core/CorePrereqs.h"
@@ -79,12 +80,12 @@
     virtual bool isServer_(){return true;}
     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();
     virtual bool chat(const std::string& message);
@@ -94,6 +95,7 @@
 
     float timeSinceLastUpdate_;
     std::deque<packet::Packet*> packetQueue_;
+    std::vector<uint32_t>       clientIDs_;
   };
 
 

Modified: code/branches/network6/src/libraries/network/ServerConnection.cc
===================================================================
--- code/branches/network6/src/libraries/network/ServerConnection.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/ServerConnection.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -34,7 +34,7 @@
 #include <enet/enet.h>
 
 #include "util/Debug.h"
-#include "ClientInformation.h"
+// #include "ClientInformation.h"
 
 namespace orxonox
 {
@@ -103,58 +103,59 @@
 
   void ServerConnection::addPacket(ENetPacket *packet, unsigned int clientID, uint8_t channelID)
   {
-    if ( clientID == CLIENTID_UNKNOWN )
+    if ( clientID == NETWORK_PEER_ID_BROADCAST )
     {
       broadcastPacket(packet, channelID);
     }
     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();
-  }
+//   int ServerConnection::getClientID(ENetAddress* address)
+//   {
+//     return ClientInformation::findClient(address)->getID();
+//   }
+// 
+//   ENetPeer *ServerConnection::getClientPeer(int clientID)
+//   {
+//     return ClientInformation::findClient(clientID)->getPeer();
+//   }
 
-  ENetPeer *ServerConnection::getClientPeer(int clientID)
-  {
-    return ClientInformation::findClient(clientID)->getPeer();
-  }
 
-
 }

Modified: code/branches/network6/src/libraries/network/ServerConnection.h
===================================================================
--- code/branches/network6/src/libraries/network/ServerConnection.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/ServerConnection.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -56,16 +56,16 @@
     bool openListener();
     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:
     ServerConnection();
     void disconnectClients();
 
   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_;
 

Modified: code/branches/network6/src/libraries/network/packet/Packet.cc
===================================================================
--- code/branches/network6/src/libraries/network/packet/Packet.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/packet/Packet.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -46,7 +46,7 @@
 #include "Gamestate.h"
 #include "Welcome.h"
 #include "network/Host.h"
-#include "network/ClientInformation.h"
+// #include "network/ClientInformation.h"
 
 namespace orxonox{
 
@@ -84,7 +84,8 @@
 }
 
 
-Packet::Packet(const Packet &p){
+Packet::Packet(const Packet &p)
+{
   enetPacket_=p.enetPacket_;
   flags_=p.flags_;
   packetDirection_ = p.packetDirection_;
@@ -103,12 +104,15 @@
 
     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
     // we have created it in the first place.
@@ -118,18 +122,22 @@
   // Destroy the ENetPacket if necessary.
   // 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_);
   }
 }
 
-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);
       return false;
@@ -174,13 +182,14 @@
   return true;
 }
 
-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;
   switch( *(Type::Value *)(data + _PACKETID) )
@@ -234,7 +243,8 @@
     ENet calls this method whenever it wants to destroy a packet that contains
     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();
   std::map<size_t, Packet*>::iterator it = packetMap_.find(reinterpret_cast<size_t>(enetPacket));

Modified: code/branches/network6/src/libraries/network/packet/Packet.h
===================================================================
--- code/branches/network6/src/libraries/network/packet/Packet.h	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/libraries/network/packet/Packet.h	2010-12-28 15:46:42 UTC (rev 7823)
@@ -31,19 +31,25 @@
 #include "network/NetworkPrereqs.h"
 #include <map>
 
-namespace orxonox {
+namespace orxonox
+{
 
-namespace packet{
+namespace packet
+{
 
-namespace Direction{
-  enum Value{
+namespace Direction
+{
+  enum Value
+  {
     Incoming,
     Outgoing,
     Bidirectional
   };
 }
-namespace Type{
-  enum Value{
+namespace Type
+{
+  enum Value
+  {
     Acknowledgement,
     Chat,
     ClassID,
@@ -58,14 +64,15 @@
 /**
     @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;
     inline uint32_t getFlags()

Modified: code/branches/network6/src/modules/overlays/hud/ChatOverlay.cc
===================================================================
--- code/branches/network6/src/modules/overlays/hud/ChatOverlay.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/modules/overlays/hud/ChatOverlay.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -70,7 +70,7 @@
     {
         std::string text;
 
-        if (senderID != CLIENTID_UNKNOWN)
+        if (senderID != NETWORK_PEER_ID_UNKNOWN)
         {
             std::string name = "unknown";
 

Modified: code/branches/network6/src/orxonox/ChatHistory.cc
===================================================================
--- code/branches/network6/src/orxonox/ChatHistory.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/ChatHistory.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -81,7 +81,7 @@
 
 #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 */
       std::string name = "unknown";

Modified: code/branches/network6/src/orxonox/ChatInputHandler.cc
===================================================================
--- code/branches/network6/src/orxonox/ChatInputHandler.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/ChatInputHandler.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -206,7 +206,7 @@
     std::string text, name = "unknown";
 
     /* setup player name info */
-    if (senderID != CLIENTID_UNKNOWN)
+    if (senderID != NETWORK_PEER_ID_UNKNOWN)
     {
        PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
        if (player)

Modified: code/branches/network6/src/orxonox/PlayerManager.cc
===================================================================
--- code/branches/network6/src/orxonox/PlayerManager.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/PlayerManager.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -44,7 +44,7 @@
     {
         RegisterRootObject(PlayerManager);
 
-        this->getConnectedClients();
+//         this->getConnectedClients();
     }
 
     PlayerManager::~PlayerManager()

Modified: code/branches/network6/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/branches/network6/src/orxonox/gamestates/GSRoot.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/gamestates/GSRoot.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -159,6 +159,6 @@
     void GSRoot::changedTimeFactor(float factor_new, float factor_old)
     {
         if (!GameMode::isStandalone())
-            callStaticNetworkFunction(&TimeFactorListener::setTimeFactor, CLIENTID_UNKNOWN, factor_new);
+            callStaticNetworkFunction(&TimeFactorListener::setTimeFactor, NETWORK_PEER_ID_BROADCAST, factor_new);
     }
 }

Modified: code/branches/network6/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/branches/network6/src/orxonox/gametypes/Dynamicmatch.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/gametypes/Dynamicmatch.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -451,7 +451,7 @@
                 {
                     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));
                 }
@@ -466,7 +466,7 @@
                   {
                        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)
                        {
@@ -500,7 +500,7 @@
                 {
                     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));
                 }
@@ -515,7 +515,7 @@
                   {
                        if (!it->first)
                            continue;
-                       if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                       if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                            continue;
                        else if (it->second==chaser)
                        {
@@ -550,7 +550,7 @@
                 {
                     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));
                 }
@@ -565,7 +565,7 @@
                   {
                        if (!it->first)
                            continue;
-                       if (it->first->getClientID() == CLIENTID_UNKNOWN)
+                       if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
                            continue;
                        else if (it->second==chaser)
                        {
@@ -631,7 +631,7 @@
         {
             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));
             }

Modified: code/branches/network6/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/network6/src/orxonox/gametypes/Gametype.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/gametypes/Gametype.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -261,9 +261,9 @@
                     {
                         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());
                     }
                 }

Modified: code/branches/network6/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/branches/network6/src/orxonox/gametypes/LastManStanding.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/gametypes/LastManStanding.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -85,7 +85,7 @@
             std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());
             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
                 this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
@@ -130,7 +130,7 @@
         
         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;
 
             if (it->second > 0)
@@ -193,7 +193,7 @@
         std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
         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
             this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
@@ -248,7 +248,7 @@
                     if (playerDelayTime_[it->first]<=0)
                     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];
                     const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown
@@ -260,7 +260,7 @@
                     if (playerGetLives(it->first)>0)
                     {
                         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
                         this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
@@ -268,7 +268,7 @@
                 }
                 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.";
                     this->gtinfo_->sendFadingMessage(message,it->first->getClientID());

Modified: code/branches/network6/src/orxonox/gametypes/TeamBaseMatch.cc
===================================================================
--- code/branches/network6/src/orxonox/gametypes/TeamBaseMatch.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/gametypes/TeamBaseMatch.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -189,7 +189,7 @@
 
             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;
 
                 if (it->second == winningteam)

Modified: code/branches/network6/src/orxonox/gametypes/UnderAttack.cc
===================================================================
--- code/branches/network6/src/orxonox/gametypes/UnderAttack.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/gametypes/UnderAttack.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -75,7 +75,7 @@
 
         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;
 
             if (it->second == 0)
@@ -157,7 +157,7 @@
 
                 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;
 
                     if (it->second == 1)

Modified: code/branches/network6/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- code/branches/network6/src/orxonox/infos/GametypeInfo.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/infos/GametypeInfo.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -73,7 +73,7 @@
     {
         if (GameMode::isMaster())
         {
-            callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), CLIENTID_UNKNOWN, message);
+            callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);
             this->dispatchAnnounceMessage(message);
         }
     }

Modified: code/branches/network6/src/orxonox/infos/HumanPlayer.cc
===================================================================
--- code/branches/network6/src/orxonox/infos/HumanPlayer.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/infos/HumanPlayer.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -31,7 +31,7 @@
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
 #include "core/GameMode.h"
-#include "network/ClientInformation.h"
+// #include "network/ClientInformation.h"
 #include "network/Host.h"
 #include "controllers/HumanController.h"
 #include "controllers/NewHumanController.h"
@@ -143,12 +143,14 @@
 
     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
     }
 
     void HumanPlayer::setClientID(unsigned int clientID)

Modified: code/branches/network6/src/orxonox/infos/PlayerInfo.cc
===================================================================
--- code/branches/network6/src/orxonox/infos/PlayerInfo.cc	2010-12-28 15:43:05 UTC (rev 7822)
+++ code/branches/network6/src/orxonox/infos/PlayerInfo.cc	2010-12-28 15:46:42 UTC (rev 7823)
@@ -31,7 +31,7 @@
 #include "PlayerInfo.h"
 
 #include "core/CoreIncludes.h"
-#include "network/ClientInformation.h"
+// #include "network/ClientInformation.h"
 #include "gametypes/Gametype.h"
 #include "worldentities/ControllableEntity.h"
 #include "controllers/Controller.h"
@@ -42,7 +42,7 @@
     {
         RegisterObject(PlayerInfo);
 
-        this->clientID_ = CLIENTID_UNKNOWN;
+        this->clientID_ = NETWORK_PEER_ID_UNKNOWN;
         this->bHumanPlayer_ = false;
         this->bLocalPlayer_ = false;
         this->bReadyToSpawn_ = false;




More information about the Orxonox-commit mailing list