Index: code/branches/objecthierarchy/src/network/Client.cc
===================================================================
--- code/branches/objecthierarchy/src/network/Client.cc	(revision 2069)
+++ code/branches/objecthierarchy/src/network/Client.cc	(revision 2070)
@@ -155,4 +155,5 @@
       COUT(5) << "tick packet size " << event->packet->dataLength << std::endl;
       packet::Packet *packet = packet::Packet::createPacket(event->packet, event->peer);
+      // note: packet commits suicide here except for the GameState. That is then deleted by a GamestateHandler
       bool b = packet->process();
       assert(b);
Index: code/branches/objecthierarchy/src/network/ClientConnection.cc
===================================================================
--- code/branches/objecthierarchy/src/network/ClientConnection.cc	(revision 2069)
+++ code/branches/objecthierarchy/src/network/ClientConnection.cc	(revision 2070)
@@ -72,5 +72,5 @@
   bool ClientConnection::waitEstablished(int milisec) {
     for(int i=0; i<=milisec && !established; i++)
-      usleep(1000);
+      msleep(1);
 
     return established;
@@ -184,5 +184,5 @@
       case ENET_EVENT_TYPE_NONE:
         //receiverThread_->yield();
-        usleep(1000);
+        msleep(1);
         break;
       }
Index: code/branches/objecthierarchy/src/network/ConnectionManager.cc
===================================================================
--- code/branches/objecthierarchy/src/network/ConnectionManager.cc	(revision 2069)
+++ code/branches/objecthierarchy/src/network/ConnectionManager.cc	(revision 2070)
@@ -227,5 +227,5 @@
         case ENET_EVENT_TYPE_NONE:
           //receiverThread_->yield();
-          usleep(1000);
+          msleep(1);
           break;
       }
Index: code/branches/objecthierarchy/src/network/packet/Gamestate.cc
===================================================================
--- code/branches/objecthierarchy/src/network/packet/Gamestate.cc	(revision 2069)
+++ code/branches/objecthierarchy/src/network/packet/Gamestate.cc	(revision 2070)
@@ -286,6 +286,16 @@
   //copy over the header
   *GAMESTATE_HEADER(ndata) = *HEADER;
-  //delete old (compressed data)
-  delete[] data_;
+
+  if (this->bDataENetAllocated_){
+    // Memory was allocated by ENet. --> We let it be since enet_packet_destroy will
+    // deallocated it anyway. So data and packet stay together.
+    this->bDataENetAllocated_ = false;
+  }
+  else{
+    // We allocated the memory in the first place (unlikely). So we destroy the old data
+    // and overwrite it with the new decompressed data.
+    delete[] this->data_;
+  }
+
   //set new pointers
   data_ = ndata;
Index: code/branches/objecthierarchy/src/network/packet/Packet.cc
===================================================================
--- code/branches/objecthierarchy/src/network/packet/Packet.cc	(revision 2069)
+++ code/branches/objecthierarchy/src/network/packet/Packet.cc	(revision 2070)
@@ -61,4 +61,5 @@
   data_=0;
   enetPacket_=0;
+  bDataENetAllocated_ = false;
 }
 
@@ -73,4 +74,5 @@
   data_=data;
   enetPacket_=0;
+  bDataENetAllocated_ = false;
 }
 
@@ -86,13 +88,32 @@
   }else
     data_=0;
-}
-
+  bDataENetAllocated_ = p.bDataENetAllocated_;
+}
+
+/**
+@brief
+    Destroys a packet completely.
+    
+    That also means destroying the ENetPacket if one exists. There 
+*/
 Packet::~Packet(){
-  if(enetPacket_){
-    assert(enetPacket_->freeCallback==0);
+  // Deallocate data_ memory if necessary.
+  if (this->bDataENetAllocated_){
+    // In this case ENet allocated data_ and will destroy it.
+  }
+  else if (this->data_) {
+    // This destructor was probably called as a consequence to 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.
+    delete[] this->data_;
+  }
+
+  // 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_){
+    // enetPacket_->data gets destroyed too by ENet if it was allocated by it.
     enet_packet_destroy(enetPacket_);
   }
-  if(data_)
-    delete[] data_;
 }
 
@@ -107,7 +128,10 @@
       return false;
     }
+    // We deliver ENet the data address so that it doesn't memcpy everything again.
+    // --> We have to delete data_ ourselves!
     enetPacket_ = enet_packet_create(getData(), getSize(), getFlags());
     enetPacket_->freeCallback = &Packet::deletePacket;
-//     enetPacket_->freeCallback = &blub;
+    // Add the packet to a global list so we can access it again once enet calls our
+    // deletePacket method. We can of course only give a one argument function to the ENet C library.
     packetMap_[enetPacket_] = this;
   }
@@ -127,7 +151,7 @@
   }
 #endif
-  ENetPacket *temp = enetPacket_;
-  enetPacket_ = 0; // otherwise we have a double free because enet already handles the deallocation of the packet
-  network::Host::addPacket( temp, clientID_);
+//  ENetPacket *temp = enetPacket_;
+//  enetPacket_ = 0; // otherwise we have a double free because enet already handles the deallocation of the packet
+  network::Host::addPacket( enetPacket_, clientID_);
   return true;
 }
@@ -170,11 +194,24 @@
       break;
   }
+
+  // Data was created by ENet
+  p->bDataENetAllocated_ = true;
+
   return p;
 }
 
-void Packet::deletePacket(ENetPacket *packet){
-  assert(packetMap_[packet]);
-  assert(packetMap_[packet]->enetPacket_==0);
-  delete packetMap_[packet];
+/**
+@brief
+    ENet calls this method whenever it wants to destroy a packet that contains
+    data we allocated ourselves.
+*/
+void Packet::deletePacket(ENetPacket *enetPacket){
+  // Get our Packet from a gloabal map with all Packets created in the send() method of Packet.
+  std::map<ENetPacket*, Packet*>::iterator it = packetMap_.find(enetPacket);
+  assert(it != packetMap_.end());
+  // Make sure we don't delete it again in the destructor
+  it->second->enetPacket_ = 0;
+  delete it->second;
+  packetMap_.erase(it);
 }
 
Index: code/branches/objecthierarchy/src/network/packet/Packet.h
===================================================================
--- code/branches/objecthierarchy/src/network/packet/Packet.h	(revision 2069)
+++ code/branches/objecthierarchy/src/network/packet/Packet.h	(revision 2070)
@@ -84,5 +84,11 @@
     unsigned int clientID_;
     ENUM::Direction packetDirection_;
+    /** Pointer to the data. Be careful when deleting it because it might
+        point to a location that was allocated by ENet.
+        See bDataENetAllocated_ */
     uint8_t *data_;
+    /** Tells whether data_ was allocated by ENet or ourselves.
+        data_ might no correlate with enetPacket_->data. */
+    bool bDataENetAllocated_;
   private:
     static std::map<ENetPacket *, Packet *> packetMap_;
Index: code/branches/objecthierarchy/visual_studio/vc8/core.vcproj
===================================================================
--- code/branches/objecthierarchy/visual_studio/vc8/core.vcproj	(revision 2069)
+++ code/branches/objecthierarchy/visual_studio/vc8/core.vcproj	(revision 2070)
@@ -165,4 +165,8 @@
 			</File>
 			<File
+				RelativePath="..\..\src\core\Event.cc"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\core\GameState.cc"
 				>
@@ -401,4 +405,12 @@
 			</File>
 			<File
+				RelativePath="..\..\src\core\Event.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\core\EventIncludes.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\core\GameState.h"
 				>
Index: code/branches/objecthierarchy/visual_studio/vc8/orxonox.vcproj
===================================================================
--- code/branches/objecthierarchy/visual_studio/vc8/orxonox.vcproj	(revision 2069)
+++ code/branches/objecthierarchy/visual_studio/vc8/orxonox.vcproj	(revision 2070)
@@ -277,9 +277,12 @@
 					</File>
 					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\ParticleEmitter.cc"
+						>
+					</File>
+					<File
 						RelativePath="..\..\src\orxonox\objects\worldentities\ParticleSpawner.cc"
 						>
 						<FileConfiguration
 							Name="Debug|Win32"
-							ExcludedFromBuild="true"
 							>
 							<Tool
@@ -289,5 +292,4 @@
 						<FileConfiguration
 							Name="Release|Win32"
-							ExcludedFromBuild="true"
 							>
 							<Tool
@@ -674,4 +676,8 @@
 					<File
 						RelativePath="..\..\src\orxonox\objects\worldentities\MovableEntity.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\objects\worldentities\ParticleEmitter.h"
 						>
 					</File>
