Index: code/branches/mergeFS18/src/libraries/network/packet/Packet.cc
===================================================================
--- code/branches/mergeFS18/src/libraries/network/packet/Packet.cc	(revision 12026)
+++ code/branches/mergeFS18/src/libraries/network/packet/Packet.cc	(revision 12027)
@@ -129,6 +129,11 @@
 }
 
+/**
+ * Send the Packet.
+ * @param host The host which sends the packet
+ */
 bool Packet::send(orxonox::Host* host)
 {
+  // Deny sending incoming packets
   if(packetDirection_ != Direction::Outgoing && packetDirection_ != Direction::Bidirectional )
   {
@@ -136,7 +141,9 @@
     return false;
   }
+
   if(!enetPacket_)
   {
-    if(!data_){
+    // Deny sending empty packets
+    if(!data_) {
       assert(0);
       return false;
@@ -152,5 +159,5 @@
       // without having a reference in the packetMap_
       Packet::packetMapMutex_.lock();
-      packetMap_[reinterpret_cast<size_t>(enetPacket_)] = this;
+      Packet::packetMap_[reinterpret_cast<size_t>(enetPacket_)] = this;
       Packet::packetMapMutex_.unlock();
     }
@@ -173,55 +180,47 @@
   }
 #endif
-//  ENetPacket *temp = enetPacket_;
-//  enetPacket_ = nullptr; // otherwise we have a double free because enet already handles the deallocation of the packet
+
+  // Send via reliable or standard channel respectively
   if( this->flags_ & PacketFlag::Reliable )
     host->addPacket( enetPacket_, peerID_, NETWORK_CHANNEL_DEFAULT);
   else
     host->addPacket( enetPacket_, peerID_, NETWORK_CHANNEL_UNRELIABLE);
+
   return true;
 }
 
+/**
+ * Given an ENetPacket, create an Orxonox packet
+ * @param packet The ENetPacket
+ * @param peerID The sender
+ */
 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();
-  // HACK
-//   if( peerID==static_cast<unsigned int>(-2))
-//     peerID = NETWORK_PEER_ID_SERVER;
   Packet *p = nullptr;
-//   orxout(verbose_ultra, context::packets) << "packet type: " << *(Type *)&data[_PACKETID] << endl;
   switch( *(Type *)(data + _PACKETID) )
   {
     case Type::Acknowledgement:
-//       orxout(verbose_more, context::packets) << "ack" << endl;
-    p = new Acknowledgement( data, peerID );
+      p = new Acknowledgement( data, peerID );
       break;
     case Type::Chat:
-//       orxout(verbose_more, context::packets) << "chat" << endl;
       p = new Chat( data, peerID );
       break;
     case Type::ClassID:
-//       orxout(verbose_more, context::packets) << "classid" << endl;
       p = new ClassID( data, peerID );
       break;
     case Type::Gamestate:
-//       orxout(verbose_more, context::packets) << "gamestate" << endl;
       p = new Gamestate( data, peerID );
       break;
     case Type::Welcome:
-//       orxout(verbose_more, context::packets) << "welcome" << endl;
       p = new Welcome( data, peerID );
       break;
     case Type::DeleteObjects:
-//       orxout(verbose_more, context::packets) << "deleteobjects" << endl;
       p = new DeleteObjects( data, peerID );
       break;
     case Type::FunctionCalls:
-//       orxout(verbose_more, context::packets) << "functionCalls" << endl;
       p = new FunctionCalls( data, peerID );
       break;
     case Type::FunctionIDs:
-//       orxout(verbose_more, context::packets) << "functionIDs" << endl;
       p = new FunctionIDs( data, peerID );
       break;
@@ -247,12 +246,14 @@
   // 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));
+
+  std::map<size_t, Packet*>::iterator it = Packet::packetMap_.find(reinterpret_cast<size_t>(enetPacket));
   assert(it != packetMap_.end());
+
   // Make sure we don't delete it again in the destructor
   it->second->enetPacket_ = nullptr;
   delete it->second;
   packetMap_.erase(it);
+
   Packet::packetMapMutex_.unlock();
-//   orxout(verbose_ultra, context::packets) << "PacketMap size: " << packetMap_.size() << endl;
 }
 
