Index: code/branches/network/src/network/GameStateClient.cc
===================================================================
--- code/branches/network/src/network/GameStateClient.cc	(revision 907)
+++ code/branches/network/src/network/GameStateClient.cc	(revision 912)
@@ -40,8 +40,13 @@
 
   bool GameStateClient::pushGameState(GameStateCompressed *compstate) {
+    GameState *gs;
     if(compstate->diffed)
-      return loadSnapshot(decode(reference, compstate));
+      gs = decode(reference, compstate);
     else
-      return loadSnapshot(decode(compstate));
+      gs = decode(compstate);
+    if(gs)
+      return loadSnapshot(gs);
+    COUT(4) << "could not use gamestate sent by server" << std::endl;
+    return false;
   }
 
Index: code/branches/network/src/network/PacketDecoder.cc
===================================================================
--- code/branches/network/src/network/PacketDecoder.cc	(revision 907)
+++ code/branches/network/src/network/PacketDecoder.cc	(revision 912)
@@ -42,5 +42,4 @@
 namespace network
 {
-  using namespace std;
 
   PacketDecoder::PacketDecoder(){}
@@ -53,5 +52,5 @@
   {
     int client = clientId;
-    cout << "clientId: " << client << endl; //control cout, not important, just debugging info
+    COUT(5) << "clientId: " << client << std::endl; //control cout, not important, just debugging info
     int id = (int)*packet->data; //the first 4 bytes are always the enet packet id
     COUT(5) << "packet id: " << id << std::endl;
@@ -145,25 +144,32 @@
   void PacketDecoder::gstate( ENetPacket* packet )
   {
-    GameStateCompressed* currentState = new GameStateCompressed;
+    GameStateCompressed* currentState = NULL;
+    currentState = new GameStateCompressed;
+    if(currentState == NULL){
+      COUT(3) << "could not generate new GameStateCompressed" << std::endl;
+      return;
+    }
     //since it's not alowed to use void* for pointer arithmetic
-    unsigned char* data = (unsigned char*)packet->data;
+    unsigned char* data = (unsigned char *)(packet->data);
     //copy the GameStateCompressed id into the struct, which is located at second place data+sizeof( int )
     //memcpy( (void*)&(currentState->id), (const void*)(data+sizeof( int )), sizeof( int ) );
-    currentState->id = (int)*(data+sizeof(int));
+    currentState->id = (int)*(packet->data+sizeof(int));
 //     std::cout << "id: " << currentState->id << std::endl;
     //copy the size of the GameStateCompressed compressed data into the new GameStateCompressed struct, located at 3th
     //position of the data stream, data+2*sizeof( int )
-//     memcpy( (void*)&(currentState->compsize), (const void*)(data+2*sizeof( int )), sizeof( int) );
+    memcpy( (void*)&(currentState->compsize), (const void*)(packet->data+2*sizeof( int )), sizeof( int) );
     //currentState->compsize = (int)*(data+2*sizeof(int));
 //     std::cout << "compsize: " << currentState->compsize << std::endl;
     //size of uncompressed data
-    memcpy( (void*)&(currentState->normsize), (const void*)(data+3*sizeof( int )), sizeof( int ) );
+    memcpy( (void*)&(currentState->normsize), (const void*)(packet->data+3*sizeof( int )), sizeof( int ) );
     //currentState->normsize = (int)*(data+3*sizeof(int));
 //     std::cout << "normsize. " << currentState->normsize << std::endl;
     //since the packetgenerator was changed, due to a new parameter, change this function too
-    memcpy( (void*)&(currentState->diffed), (const void*)(data+4*sizeof(int)), sizeof(bool));
+    memcpy( (void*)&(currentState->diffed), (const void*)(packet->data+4*sizeof(int)), sizeof(bool));
     //currentState->diffed = (bool)*(data+4*sizeof(int));
 //     std::cout << "diffed: " << currentState->diffed << std::endl;
     //since data is not allocated, because it's just a pointer, allocate it with size of gamestatedatastream
+    if(currentState->compsize==0)
+      COUT(2) << "compsize is 0" << std::endl;
     currentState->data = (unsigned char*)(malloc( currentState->compsize ));
     if(currentState->data==NULL)
@@ -172,5 +178,5 @@
     //std::cout << "packet size (enet): " << packet->dataLength << std::endl;
     //std::cout << "totallen: " << 4*sizeof(int)+sizeof(bool)+currentState->compsize << std::endl;
-    memcpy( (void*)(currentState->data), (const void*)(data+4*sizeof( int ) + sizeof(bool)), currentState->compsize );
+    memcpy( (void*)(currentState->data), (const void*)(packet->data+4*sizeof( int ) + sizeof(bool)), currentState->compsize );
 
     //clean memory
@@ -222,18 +228,18 @@
   void PacketDecoder::printAck( ack* data )
   {
-    COUT(5) << "data id: " << data->id << endl;
-    COUT(5) << "data:    " << data->a << endl;
+    COUT(5) << "data id: " << data->id << std::endl;
+    COUT(5) << "data:    " << data->a << std::endl;
   }
 
   void PacketDecoder::printMouse( mouse* data )
   {
-    COUT(5) << "data id: " << data->id << endl;
-    COUT(5) << "data:    " << data->x << " " << data->y << endl;
+    COUT(5) << "data id: " << data->id << std::endl;
+    COUT(5) << "data:    " << data->x << " " << data->y << std::endl;
   }
 
   void PacketDecoder::printKey( keyboard* data )
   {
-    COUT(5) << "data id: " << data->id << endl;
-    COUT(5) << "data:    " << (char)data->press << endl;
+    COUT(5) << "data id: " << data->id << std::endl;
+    COUT(5) << "data:    " << (char)data->press << std::endl;
   }
 
@@ -241,21 +247,21 @@
   {
     if(clientId!=CLIENTID_CLIENT)
-      COUT(5) << "client: " << clientId << endl;
-    COUT(5) << "data id: " << data->id << endl;
-    COUT(5) << "data:    " << data->message << endl;
+      COUT(5) << "client: " << clientId << std::endl;
+    COUT(5) << "data id: " << data->id << std::endl;
+    COUT(5) << "data:    " << data->message << std::endl;
   }
 
   void PacketDecoder::printGamestate( GameStateCompressed* data )
   {
-    COUT(5) << "id of GameStateCompressed:   " << data->id << endl;
-    COUT(5) << "size of GameStateCompressed: " << data->compsize << endl;
+    COUT(5) << "id of GameStateCompressed:   " << data->id << std::endl;
+    COUT(5) << "size of GameStateCompressed: " << data->compsize << std::endl;
   }
 
   void PacketDecoder::printClassid( classid *cid)
   {
-    COUT(5) << "id of classid:    " << cid->id << endl;
-    COUT(5) << "size of classid:  " << cid->length << endl;
-    COUT(5) << "ID of classid:    " << cid->clid <<endl;
-    COUT(5) << "data of classid:  " << cid->message <<endl;
+    COUT(5) << "id of classid:    " << cid->id << std::endl;
+    COUT(5) << "size of classid:  " << cid->length << std::endl;
+    COUT(5) << "ID of classid:    " << cid->clid << std::endl;
+    COUT(5) << "data of classid:  " << cid->message << std::endl;
   }
 
Index: code/branches/network/src/network/Server.cc
===================================================================
--- code/branches/network/src/network/Server.cc	(revision 907)
+++ code/branches/network/src/network/Server.cc	(revision 912)
@@ -112,4 +112,5 @@
     processQueue();
     updateGamestate();
+    sleep(1); // TODO remove
     return;
   }
@@ -178,4 +179,5 @@
 
   void Server::processAck( ack *data, int clientID) {
+    COUT(5) << "processing ack from client: " << clientID << "; ack-id: " << data->id << std::endl;
     clients->findClient(clientID)->setGamestateID(data->a);
   }
