Index: code/branches/network/src/network/GameStateManager.cc
===================================================================
--- code/branches/network/src/network/GameStateManager.cc	(revision 247)
+++ code/branches/network/src/network/GameStateManager.cc	(revision 247)
@@ -0,0 +1,32 @@
+//
+// C++ Implementation: GameStateManager
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "GameStateManager.h"
+
+namespace network {
+
+GameStateManager::GameStateManager()
+{
+}
+
+GameStateManager::~GameStateManager()
+{
+}
+
+GameState GameStateManager::getSnapshot(){
+  
+}
+
+bool GameStateManager::loadSnapshot(GameState state){
+  
+}
+
+}
Index: code/branches/network/src/network/GameStateManager.h
===================================================================
--- code/branches/network/src/network/GameStateManager.h	(revision 247)
+++ code/branches/network/src/network/GameStateManager.h	(revision 247)
@@ -0,0 +1,46 @@
+//
+// C++ Interface: GameStateManager
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef NETWORK_GAMESTATEMANAGER_H
+#define NETWORK_GAMESTATEMANAGER_H
+
+namespace network {
+
+/**
+ * This struct defines a gamestate:
+ * size: total size of the data in *data
+ * data: pointer to the data allocated in the memory
+ */
+struct GameState{
+  int size;
+  unsigned char *data;
+};
+
+/**
+ * This Class implements a manager for gamestates:
+ * - creating snapshots of gamestates
+ * - writing gamestates to universe
+ * - diffing gamestates ?
+ * @author Oliver Scheuss
+*/
+class GameStateManager{
+public:
+  GameStateManager();
+  ~GameStateManager();
+  GameState getSnapshot();
+  bool loadSnapshot(GameState state);
+private:
+  
+};
+
+}
+
+#endif
Index: code/branches/network/src/network/Makefile
===================================================================
--- code/branches/network/src/network/Makefile	(revision 245)
+++ code/branches/network/src/network/Makefile	(revision 247)
@@ -29,4 +29,6 @@
 Synchronisable.o: Synchronisable.cc
 	${CC} -c Synchronisable.cc -g ${INC}
+GameStateManager.o: GameStateManager.cc
+	${CC} -c GameStateManager.cc -g ${INC}
 
 clean:
Index: code/branches/network/src/network/Makefile.tardis
===================================================================
--- code/branches/network/src/network/Makefile.tardis	(revision 245)
+++ code/branches/network/src/network/Makefile.tardis	(revision 247)
@@ -28,4 +28,8 @@
 PacketDecoder.o: PacketDecoder.cc
 	${CC} -c PacketDecoder.cc -o PacketDecoder.o -g ${INC}
+Synchronisable.o: Synchronisable.cc
+	${CC} -c Synchronisable.cc -g ${INC}
+GameStateManager.o: GameStateManager.cc
+	${CC} -c GameStateManager.cc -g ${INC}
 
 clean:
Index: code/branches/network/src/network/Synchronisable.cc
===================================================================
--- code/branches/network/src/network/Synchronisable.cc	(revision 245)
+++ code/branches/network/src/network/Synchronisable.cc	(revision 247)
@@ -5,5 +5,5 @@
 //
 //
-// Author:  Oliver Scheuss, (C) 2007
+// Author:  Dumeni, Oliver Scheuss, (C) 2007
 //
 // Copyright: See COPYING file that comes with this distribution
@@ -14,6 +14,11 @@
 namespace network {
 
+/**
+ * Constructor:
+ * calls registarAllVariables, that has to be implemented by the inheriting classID
+ */
 Synchronisable::Synchronisable()
 {
+  datasize=0;
   registerAllVariables();
 }
@@ -25,8 +30,28 @@
 }
 
+/**
+ * This function is used to register a variable to be synchronized
+ * also counts the total datasize needed to save the variables
+ * @param var pointer to the variable
+ * @param size size of the datatype the variable consists of
+ */
 void Synchronisable::registerVar(const void *var, int size){
+  // create temporary synch.Var struct
   synchronisableVariable temp={size, var};
+  // increase datasize
+  datasize+=sizeof(int)+size;
+  // push temp to syncList (at the bottom)
   syncList.push_back(temp);
 }
+
+/**
+ * note: only use this function for debug use, because it's inefficient (in order to produce a gamestate, you have to copy the whole data again to another memory location after this process)
+ * This function takes all SynchronisableVariables out of the Synchronisable and saves it into a syncData struct
+ * structure of the bitstream:
+ * (var1_size,var1,var2_size,var2,...)
+ * varx_size: size = sizeof(int)
+ * varx: size = varx_size
+ * @return data containing all variables and their sizes
+ */
 syncData Synchronisable::getData(){
   std::list<synchronisableVariable>::iterator i;
@@ -56,4 +81,40 @@
   return retVal;
 }
+/**
+ * This function takes all SynchronisableVariables out of the Synchronisable and saves it into a syncData struct
+ * Difference to the above function:
+ * takes a pointer to already allocated memory (must have at least getSize bytes length)
+ * structure of the bitstream:
+ * (var1_size,var1,var2_size,var2,...)
+ * varx_size: size = sizeof(int)
+ * varx: size = varx_size
+ * @return data containing all variables and their sizes
+ */
+syncData Synchronisable::getData(unsigned char *mem){
+  std::list<synchronisableVariable>::iterator i;
+  syncData retVal;
+  retVal.objectID=this->objectID;
+  retVal.classID=this->classID;
+  retVal.length=datasize;
+  retVal.data=mem;
+  // copy to location
+  //CHANGED: REMOVED DECLARATION int n=0 FROM LOOP
+  int n=0;
+  for(i=syncList.begin(); n<datasize && i!=syncList.end(); i++){
+        //CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID*  
+    std::memcpy(retVal.data+n, (const void*)(i->size), sizeof(int));
+    n+=sizeof(int);
+    //CHANGED: i->var TO (const void*)(&(i->var)) SINCE var IS A POINTER, NO & BEFORE i
+    std::memcpy(retVal.data+n, (const void*)(i->var), i->size);
+    n+=i->size;
+  }
+  return retVal;
+}
+
+/**
+ * This function takes a syncData struct and takes it to update the variables
+ * @param vars data of the variables
+ * @return true/false
+ */
 bool Synchronisable::updateData(syncData vars){
   unsigned char *data=vars.data;
@@ -70,3 +131,11 @@
 }
 
+/**
+ * This function returns the total amount of bytes needed by getData to save the whole content of the variables
+ * @return amount of bytes
+ */
+int Synchronisable::getSize(){
+  return datasize;
 }
+
+}
Index: code/branches/network/src/network/Synchronisable.h
===================================================================
--- code/branches/network/src/network/Synchronisable.h	(revision 245)
+++ code/branches/network/src/network/Synchronisable.h	(revision 247)
@@ -10,6 +10,6 @@
 //
 //
-#ifndef NETWORKSYNCHRONISABLE_H
-#define NETWORKSYNCHRONISABLE_H
+#ifndef NETWORK_SYNCHRONISABLE_H
+#define NETWORK_SYNCHRONISABLE_H
 
 #include <list>
@@ -46,4 +46,6 @@
   void registerVar(const void *var, int size);
   syncData getData();
+  syncData getData(unsigned char *mem);
+  int getSize();
   bool updateData(syncData vars);
   virtual void registerAllVariables();
@@ -51,4 +53,5 @@
 private:
   std::list<SYNCVAR> syncList;
+  int datasize;
 };
 
