Index: code/branches/FICN/src/network/GameStateManager.cc
===================================================================
--- code/branches/FICN/src/network/GameStateManager.cc	(revision 417)
+++ code/branches/FICN/src/network/GameStateManager.cc	(revision 422)
@@ -24,5 +24,7 @@
 
 void GameStateManager::update(){
-  reference = getSnapshot(id++);
+  reference = getSnapshot(id);
+  idGameState[id]=reference;
+  ++id;
   return;
 }
@@ -30,5 +32,5 @@
 GameStateCompressed GameStateManager::popGameState(int clientID){
   GameState *client = clientGameState[clientID];  
-  GameState *server = &reference;
+  GameState *server = reference;
   return encode(client, server);
 }
@@ -41,5 +43,5 @@
  * @return struct of type gamestate containing the size of the whole gamestate and a pointer linking to the flat list
  */
-GameState GameStateManager::getSnapshot(int id)
+GameState *GameStateManager::getSnapshot(int id)
 {
   //the size of the gamestate
@@ -52,8 +54,8 @@
   syncData sync;
   
-  GameState retval; //return value
-  retval.id=id;
+  GameState *retval=new GameState; //return value
+  retval->id=id;
   // reserve a little memory and increase it later on
-  retval.data = (unsigned char*)malloc(1);
+  retval->data = (unsigned char*)malloc(1);
   
   // offset of memory functions
@@ -66,15 +68,15 @@
     totalsize+=tempsize+3*sizeof(int);
     // allocate additional space
-    retval.data = (unsigned char *)realloc((void *)retval.data, totalsize);
+    retval->data = (unsigned char *)realloc((void *)retval->data, totalsize);
     
     // run Synchronisable::getData with offset and additional place for 3 ints in between (for ids and length)
-    sync=it->getData(retval.data+offset+3*sizeof(int));
-    *(retval.data+offset)=sync.length;
-    *(retval.data+offset+sizeof(int))=sync.objectID;
-    *(retval.data+offset+2*sizeof(int))=sync.classID;
+    sync=it->getData(retval->data+offset+3*sizeof(int));
+    *(retval->data+offset)=sync.length;
+    *(retval->data+offset+sizeof(int))=sync.objectID;
+    *(retval->data+offset+2*sizeof(int))=sync.classID;
     // increase data pointer
     offset+=tempsize+3*sizeof(int);
   }
-  retval.size=totalsize;
+  retval->size=totalsize;
   return retval;
 }
@@ -143,5 +145,18 @@
 }
 
+void GameStateManager::ackGameState(int clientID, int gamestateID){
+  GameState *old = clientGameState[clientID];
+  deleteUnusedGameState(old);
+  clientGameState[clientID]=idGameState[gamestateID];
+}
 
+bool GameStateManager::deleteUnusedGameState(GameState *state){
+  for(unsigned int i=0; i<clientGameState.size(); i++){
+    if(clientGameState[i]==state)
+      return false;
+  }
+  delete state;
+  return true;
+}
 
 }
Index: code/branches/FICN/src/network/GameStateManager.h
===================================================================
--- code/branches/FICN/src/network/GameStateManager.h	(revision 417)
+++ code/branches/FICN/src/network/GameStateManager.h	(revision 422)
@@ -47,12 +47,15 @@
   void update();
   GameStateCompressed popGameState(int clientID);
+  void ackGameState(int clientID, int gamestateID);
 private:
-  GameState getSnapshot(int id);
+  GameState *getSnapshot(int id);
   GameStateCompressed encode(GameState *a, GameState *b);
   GameState diff(GameState *a, GameState *b);
   GameStateCompressed compress_(GameState a);
+  bool deleteUnusedGameState(GameState *state);
   
   std::vector<GameState *> clientGameState;
-  GameState reference;
+  std::vector<GameState *> idGameState;
+  GameState *reference;
   int id;
 };
Index: code/branches/FICN/src/network/PacketManager.h
===================================================================
--- code/branches/FICN/src/network/PacketManager.h	(revision 417)
+++ code/branches/FICN/src/network/PacketManager.h	(revision 422)
@@ -50,9 +50,9 @@
         
 	
-	void acknowledgement( ENetPacket* packet );
-	void mousem( ENetPacket* packet );
-	void keystrike( ENetPacket* packet );
-	void chatMessage( ENetPacket* packet );
-	void gstate( ENetPacket* packet );
+    void acknowledgement( ENetPacket* packet );
+    void mousem( ENetPacket* packet );
+    void keystrike( ENetPacket* packet );
+    void chatMessage( ENetPacket* packet );
+    void gstate( ENetPacket* packet );
     void clid( ENetPacket *packet);
 	
Index: code/branches/FICN/src/network/Server.cc
===================================================================
--- code/branches/FICN/src/network/Server.cc	(revision 417)
+++ code/branches/FICN/src/network/Server.cc	(revision 422)
@@ -103,4 +103,5 @@
     while(!connection.queueEmpty()){
       packet = connection.getPacket(clientID);
+      elaborate(packet, clientID);
     }
   }
@@ -110,4 +111,10 @@
    */
   void Server::updateGamestate(){
+    gamestates.update();
+    sendGameState();
+  }
+  
+  bool Server::sendGameState(){
+    
   }
   
Index: code/branches/FICN/src/network/Server.h
===================================================================
--- code/branches/FICN/src/network/Server.h	(revision 417)
+++ code/branches/FICN/src/network/Server.h	(revision 422)
@@ -38,4 +38,5 @@
     void tick();
     private:
+    bool sendGameState();
     ConnectionManager connection;
     GameStateManager gamestates;
