Index: /code/branches/network/src/network/GamestateClient.cc
===================================================================
--- /code/branches/network/src/network/GamestateClient.cc	(revision 1711)
+++ /code/branches/network/src/network/GamestateClient.cc	(revision 1712)
@@ -74,5 +74,5 @@
     int id = GAMESTATEID_INITIAL;
     bool b = saveShipCache();
-    if(tempGamestate_->spreadData()){
+    if(processGamestate(tempGamestate_)){
       if(b)
         loadShipCache();
@@ -151,4 +151,10 @@
   }
 
+  bool GamestateClient::processGamestate(packet::Gamestate *gs){
+    assert(gs->decompressData());
+    if(gs->isDiffed())
+      assert(gs->undiff(gamestateMap_[gs->getBaseID()]));
+    return gs->spreadData();
+  }
 
 }
Index: /code/branches/network/src/network/GamestateClient.h
===================================================================
--- /code/branches/network/src/network/GamestateClient.h	(revision 1711)
+++ /code/branches/network/src/network/GamestateClient.h	(revision 1712)
@@ -66,4 +66,5 @@
     void cleanup();
   private:
+    bool processGamestate(packet::Gamestate *gs);
     void removeObject(orxonox::Iterator<Synchronisable> &it);
     void printGamestateMap();
Index: /code/branches/network/src/network/GamestateManager.cc
===================================================================
--- /code/branches/network/src/network/GamestateManager.cc	(revision 1711)
+++ /code/branches/network/src/network/GamestateManager.cc	(revision 1712)
@@ -81,5 +81,5 @@
     // now push only the most recent gamestates we received (ignore obsolete ones)
     for(it = gamestateQueue.begin(); it!=gamestateQueue.end(); it++){
-      it->second->spreadData();
+      assert(processGamestate(it->second));
       delete it->second;
     }
@@ -197,4 +197,10 @@
     ClientInformation::removeClient(client->getID());
   }
+  
+  bool GamestateManager::processGamestate(packet::Gamestate *gs){
+    assert(gs->decompressData());
+    assert(!gs->isDiffed());
+    return gs->spreadData();
+  }
 
 }
Index: /code/branches/network/src/network/GamestateManager.h
===================================================================
--- /code/branches/network/src/network/GamestateManager.h	(revision 1711)
+++ /code/branches/network/src/network/GamestateManager.h	(revision 1712)
@@ -82,5 +82,6 @@
     private:
     void cleanup(); // "garbage handler"
-
+    bool processGamestate(packet::Gamestate *gs);
+    
     std::map<int, packet::Gamestate*> gamestateMap; //map gsID to gamestate*
     std::map<int, int> gamestateUsed; // save the number of clients, that use the specific gamestate
Index: /code/branches/network/src/network/Server.cc
===================================================================
--- /code/branches/network/src/network/Server.cc	(revision 1711)
+++ /code/branches/network/src/network/Server.cc	(revision 1712)
@@ -131,4 +131,5 @@
   bool Server::sendChat(packet::Chat *chat) {
     //TODO: change this (no informations about who wrote a message)
+    assert(0);
     ClientInformation *temp = ClientInformation::getBegin();
     while(temp){
@@ -321,5 +322,4 @@
     w->setClientID(temp->getID());
     assert(w->send());
-    delete w;
     return true;
   }
Index: /code/branches/network/src/network/packet/Chat.cc
===================================================================
--- /code/branches/network/src/network/packet/Chat.cc	(revision 1711)
+++ /code/branches/network/src/network/packet/Chat.cc	(revision 1712)
@@ -44,5 +44,5 @@
   messageLength_ = message.length()+1;
   data_=new unsigned char[ getSize() ];
-  *(ENUM::Type *)&data_[ _PACKETID ] = packet::ENUM::Chat;
+  *(ENUM::Type *)&data_[ _PACKETID ] = ENUM::Chat;
   *(unsigned int *)&data_[ _MESSAGELENGTH ] = messageLength_;
   memcpy( &data_[ _MESSAGE ], (void *)message.c_str(), messageLength_ );
Index: /code/branches/network/src/network/packet/ClassID.cc
===================================================================
--- /code/branches/network/src/network/packet/ClassID.cc	(revision 1711)
+++ /code/branches/network/src/network/packet/ClassID.cc	(revision 1712)
@@ -51,5 +51,5 @@
   data_=new unsigned char[ getSize() ];
   assert(data_);
-  *(packet::ENUM::Type *)&data_[ _PACKETID ] = packet::ENUM::ClassID;
+  *(ENUM::Type *)&data_[ _PACKETID ] = ENUM::ClassID;
   *(unsigned int *)&data_[ _CLASSID ] = classID;
   *(unsigned int *)&data_[ _CLASSNAMELENGTH ] = classNameLength_;
Index: /code/branches/network/src/network/packet/Gamestate.cc
===================================================================
--- /code/branches/network/src/network/packet/Gamestate.cc	(revision 1711)
+++ /code/branches/network/src/network/packet/Gamestate.cc	(revision 1712)
@@ -1,20 +1,2 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 /*
  *   ORXONOX - the hottest 3D action shooter ever to exist
@@ -124,4 +106,5 @@
   //start write gamestate header
   HEADER->packetType = ENUM::Gamestate;
+  assert( *(ENUM::Type *)&data_[ 0 ] == ENUM::Gamestate);
   HEADER->normsize = currentsize;
   HEADER->id = id;
@@ -230,4 +213,5 @@
 bool Gamestate::decompressData()
 {
+  assert(compressed_);
   //COUT(4) << "GameStateClient: uncompressing gamestate. id: " << a->id << ", baseid: " << a->base_id << ", normsize: " << a->normsize << ", compsize: " << a->compsize << std::endl;
   int normsize = HEADER->normsize;
@@ -256,5 +240,5 @@
   *GAMESTATE_HEADER(ndata) = *HEADER;
   //delete old (compressed data)
-  delete []data_;
+  delete[] data_;
   //set new pointers and create bytestream
   data_ = ndata;
@@ -349,5 +333,12 @@
   }
 
-}
-
-}
+  bool Gamestate::isDiffed(){
+    return HEADER->diffed;
+  }
+  
+  int Gamestate::getBaseID(){
+    return HEADER->base_id;
+  }
+}
+
+}
Index: /code/branches/network/src/network/packet/Gamestate.h
===================================================================
--- /code/branches/network/src/network/packet/Gamestate.h	(revision 1711)
+++ /code/branches/network/src/network/packet/Gamestate.h	(revision 1712)
@@ -62,4 +62,6 @@
     bool spreadData(int mode=0x0);
     int getID();
+    bool isDiffed();
+    int getBaseID();
     Gamestate *diff(Gamestate *base);
     Gamestate *undiff(Gamestate *base);
Index: /code/branches/network/src/network/packet/Packet.cc
===================================================================
--- /code/branches/network/src/network/packet/Packet.cc	(revision 1711)
+++ /code/branches/network/src/network/packet/Packet.cc	(revision 1712)
@@ -60,4 +60,8 @@
 }
 
+void blub(ENetPacket *packet){
+  COUT(0) << "blubb" << std::endl;
+}
+
 Packet::Packet(unsigned char *data, int clientID){
   flags_ = PACKET_FLAG_DEFAULT;
@@ -73,8 +77,8 @@
   clientID_ = ClientInformation::findClient(&peer->address)->getID();
   data_ = packet->data;
-  enet_packet_destroy(packet);
 }
 
 Packet::Packet(const Packet &p){
+  enetPacket_=p.enetPacket_;
   flags_=p.flags_;
   if(p.data_){
@@ -93,11 +97,15 @@
 
 bool Packet::send(){
-  if(packetDirection_ != ENUM::Outgoing && packetDirection_ != ENUM::Bidirectional )
+  /*if(packetDirection_ != ENUM::Outgoing && packetDirection_ != ENUM::Bidirectional ){
+    assert(0);
     return false;
+  }*/
   if(!enetPacket_){
-    if(!data_)
+    if(!data_){
+      assert(0);
       return false;
+    }
     enetPacket_ = enet_packet_create(getData(), getSize(), getFlags());
-    enetPacket_->freeCallback = &Packet::deletePacket;
+    enetPacket_->freeCallback = &blub;
     packetMap_[enetPacket_] = this;
   }
