Index: code/branches/network/src/network/packet/Gamestate.cc
===================================================================
--- code/branches/network/src/network/packet/Gamestate.cc	(revision 1834)
+++ code/branches/network/src/network/packet/Gamestate.cc	(revision 1901)
@@ -47,15 +47,20 @@
 
   
+#define PACKET_FLAG_GAMESTATE  ENET_PACKET_FLAG_RELIABLE
+  
 Gamestate::Gamestate()
 {
-}
-
-Gamestate::Gamestate(unsigned char *data, int clientID):
+  flags_ = flags_ | PACKET_FLAG_GAMESTATE;
+}
+
+Gamestate::Gamestate(uint8_t *data, unsigned int clientID):
     Packet(data, clientID)
 {
-}
-
-Gamestate::Gamestate(unsigned char *data)
-{
+  flags_ = flags_ | PACKET_FLAG_GAMESTATE;
+}
+
+Gamestate::Gamestate(uint8_t *data)
+{
+  flags_ = flags_ | PACKET_FLAG_GAMESTATE;
   data_=data;
 }
@@ -86,5 +91,5 @@
 #endif
   //start collect data synchronisable by synchronisable
-  unsigned char *mem=data_;
+  uint8_t *mem=data_;
   mem+=sizeof(GamestateHeader);
   orxonox::ObjectList<Synchronisable>::iterator it;
@@ -99,5 +104,5 @@
       while(++temp)
         addsize+=temp->getSize(id, mode);
-      data_ = (unsigned char *)realloc(data_, sizeof(GamestateHeader) + currentsize + addsize);
+      data_ = (uint8_t *)realloc(data_, sizeof(GamestateHeader) + currentsize + addsize);
       if(!data_)
         return false;
@@ -140,5 +145,5 @@
   assert(!HEADER->compressed);
   assert(!HEADER->diffed);
-  unsigned char *mem=data_+sizeof(GamestateHeader);
+  uint8_t *mem=data_+sizeof(GamestateHeader);
     // get the start of the Synchronisable list
   //orxonox::ObjectList<Synchronisable>::iterator it=orxonox::ObjectList<Synchronisable>::begin();
@@ -159,5 +164,6 @@
     else
     {
-      assert(s->updateData(mem, mode));
+      bool b = s->updateData(mem, mode);
+      assert(b);
       //if(!s->updateData(mem, mode))
         //return false;
@@ -186,6 +192,6 @@
 
 bool Gamestate::operator==(packet::Gamestate gs){
-  unsigned char *d1 = data_+sizeof(GamestateHeader);
-  unsigned char *d2 = gs.data_+sizeof(GamestateHeader);
+  uint8_t *d1 = data_+sizeof(GamestateHeader);
+  uint8_t *d2 = gs.data_+sizeof(GamestateHeader);
   assert(!isCompressed());
   assert(!gs.isCompressed());
@@ -215,8 +221,8 @@
     return false;
 
-  unsigned char *ndata = new unsigned char[buffer+sizeof(GamestateHeader)];
-  unsigned char *dest = GAMESTATE_START(ndata);
+  uint8_t *ndata = new uint8_t[buffer+sizeof(GamestateHeader)];
+  uint8_t *dest = GAMESTATE_START(ndata);
   //unsigned char *dest = new unsigned char[buffer];
-  unsigned char *source = GAMESTATE_START(data_);
+  uint8_t *source = GAMESTATE_START(data_);
   int retval;
   retval = compress( dest, &buffer, source, (uLong)(HEADER->datasize) );
@@ -229,6 +235,6 @@
 #ifndef NDEBUG
   //decompress and compare the start and the decompressed data
-  unsigned char *rdata = new unsigned char[HEADER->datasize+sizeof(GamestateHeader)];
-  unsigned char *d2 = GAMESTATE_START(rdata);
+  uint8_t *rdata = new uint8_t[HEADER->datasize+sizeof(GamestateHeader)];
+  uint8_t *d2 = GAMESTATE_START(rdata);
   uLongf length2 = HEADER->datasize;
   uncompress(d2, &length2, dest, buffer);
@@ -265,7 +271,7 @@
   bufsize = datasize;
   assert(bufsize!=0);
-  unsigned char *ndata = new unsigned char[bufsize + sizeof(GamestateHeader)];
-  unsigned char *dest = ndata + sizeof(GamestateHeader);
-  unsigned char *source = data_ + sizeof(GamestateHeader);
+  uint8_t *ndata = new uint8_t[bufsize + sizeof(GamestateHeader)];
+  uint8_t *dest = ndata + sizeof(GamestateHeader);
+  uint8_t *source = data_ + sizeof(GamestateHeader);
   int retval;
   uLongf length=bufsize;
@@ -299,5 +305,5 @@
   assert(!HEADER->diffed);
   //unsigned char *basep = base->getGs()/*, *gs = getGs()*/;
-  unsigned char *basep = GAMESTATE_START(base->data_), *gs = GAMESTATE_START(this->data_);
+  uint8_t *basep = GAMESTATE_START(base->data_), *gs = GAMESTATE_START(this->data_);
   unsigned int of=0; // pointers offset
   unsigned int dest_length=0;
@@ -305,6 +311,6 @@
   if(dest_length==0)
     return NULL;
-  unsigned char *ndata = new unsigned char[dest_length*sizeof(unsigned char)+sizeof(GamestateHeader)];
-  unsigned char *dest = ndata + sizeof(GamestateHeader);
+  uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+sizeof(GamestateHeader)];
+  uint8_t *dest = ndata + sizeof(GamestateHeader);
   while(of < GAMESTATE_HEADER(base->data_)->datasize && of < HEADER->datasize){
     *(dest+of)=*(basep+of)^*(gs+of); // do the xor
@@ -312,5 +318,5 @@
   }
   if(GAMESTATE_HEADER(base->data_)->datasize!=HEADER->datasize){
-    unsigned char n=0;
+    uint8_t n=0;
     if(GAMESTATE_HEADER(base->data_)->datasize < HEADER->datasize){
       while(of<dest_length){
@@ -335,5 +341,5 @@
   
   Gamestate *gs = new Gamestate(*this);
-  unsigned char *ndata = gs->data_ + sizeof(GamestateHeader);
+  uint8_t *ndata = gs->data_ + sizeof(GamestateHeader);
   synchronisableHeader *objectheader;
   unsigned int objectOffset;
@@ -344,5 +350,5 @@
     unsigned int objectsize = objectheader->size;
     assert(it->second->objectID==objectheader->objectID);
-    objectOffset=sizeof(unsigned int)+sizeof(bool); //skip the size and the availableDate variables in the objectheader
+    objectOffset=sizeof(uint8_t)+sizeof(bool); //skip the size and the availableDate variables in the objectheader
     if(!it->second->doSelection(HEADER->id)){
       while(objectOffset<objectsize){
@@ -370,5 +376,5 @@
   //preparations
   std::map<unsigned int, Synchronisable *>::iterator it;
-  unsigned char *origdata, *basedata, *destdata, *ndata;
+  uint8_t *origdata, *basedata, *destdata, *ndata;
   unsigned int objectOffset, streamOffset=0;    //data offset
   unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 
@@ -378,5 +384,5 @@
   origdata = GAMESTATE_START(this->data_);
   basedata = GAMESTATE_START(base->data_);
-  ndata = new unsigned char[HEADER->datasize + sizeof(GamestateHeader)];
+  ndata = new uint8_t[HEADER->datasize + sizeof(GamestateHeader)];
   destdata = ndata + sizeof(GamestateHeader);
   
@@ -390,12 +396,12 @@
     //copy and partially diff the object header
     assert(sizeof(synchronisableHeader)==3*sizeof(unsigned int)+sizeof(bool));
-    *(unsigned int*)destdata = *(unsigned int*)origdata; //size (do not diff)
-    *(bool*)(destdata+sizeof(unsigned int)) = sendData;
+    *(uint32_t*)destdata = *(uint32_t*)origdata; //size (do not diff)
+    *(bool*)(destdata+sizeof(uint32_t)) = sendData;
     if(sendData){
-      *(unsigned int*)(destdata+sizeof(unsigned int)+sizeof(bool)) = *(unsigned int*)(basedata+sizeof(unsigned int)+sizeof(bool)) ^ *(unsigned int*)(origdata+sizeof(unsigned int)+sizeof(bool)); //objectid (diff it)
-      *(unsigned int*)(destdata+2*sizeof(unsigned int)+sizeof(bool)) = *(unsigned int*)(basedata+2*sizeof(unsigned int)+sizeof(bool)) ^ *(unsigned int*)(origdata+2*sizeof(unsigned int)+sizeof(bool)); //classid (diff it)
+      *(uint32_t*)(destdata+sizeof(uint32_t)+sizeof(bool)) = *(uint32_t*)(basedata+sizeof(uint32_t)+sizeof(bool)) ^ *(uint32_t*)(origdata+sizeof(uint32_t)+sizeof(bool)); //objectid (diff it)
+      *(uint32_t*)(destdata+2*sizeof(uint32_t)+sizeof(bool)) = *(uint32_t*)(basedata+2*sizeof(uint32_t)+sizeof(bool)) ^ *(uint32_t*)(origdata+2*sizeof(uint32_t)+sizeof(bool)); //classid (diff it)
     }else{
-      *(unsigned int*)(destdata+sizeof(unsigned int)+sizeof(bool)) = 0;
-      *(unsigned int*)(destdata+2*sizeof(unsigned int)+sizeof(bool)) = 0; 
+      *(uint32_t*)(destdata+sizeof(uint32_t)+sizeof(bool)) = 0;
+      *(uint32_t*)(destdata+2*sizeof(uint32_t)+sizeof(bool)) = 0; 
     }
     objectOffset=sizeof(synchronisableHeader);
@@ -408,5 +414,5 @@
         *(destdata+objectOffset)=*(basedata+objectOffset)^*(origdata+objectOffset); // do the xor
       else if(sendData)
-        *(destdata+objectOffset)=((unsigned char)0)^*(origdata+objectOffset); // xor with 0 (basestream is too short)
+        *(destdata+objectOffset)=((uint8_t)0)^*(origdata+objectOffset); // xor with 0 (basestream is too short)
       else
         *(destdata+objectOffset)=0; // set to 0 because this object should not be transfered
@@ -438,5 +444,5 @@
   //preparations
   std::map<unsigned int, Synchronisable *>::iterator it;
-  unsigned char *origdata, *basedata, *destdata, *ndata;
+  uint8_t *origdata, *basedata, *destdata, *ndata;
   unsigned int objectOffset, streamOffset=0;    //data offset
   unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 
@@ -446,5 +452,5 @@
   origdata = GAMESTATE_START(this->data_);
   basedata = GAMESTATE_START(base->data_);
-  ndata = new unsigned char[HEADER->datasize + sizeof(GamestateHeader)];
+  ndata = new uint8_t[HEADER->datasize + sizeof(GamestateHeader)];
   destdata = ndata + sizeof(GamestateHeader);
   
@@ -502,6 +508,6 @@
   assert(!HEADER->compressed && !GAMESTATE_HEADER(base->data_)->compressed);
   //unsigned char *basep = base->getGs()/*, *gs = getGs()*/;
-  unsigned char *basep = GAMESTATE_START(base->data_);
-  unsigned char *gs = GAMESTATE_START(this->data_);
+  uint8_t *basep = GAMESTATE_START(base->data_);
+  uint8_t *gs = GAMESTATE_START(this->data_);
   unsigned int of=0; // pointers offset
   unsigned int dest_length=0;
@@ -509,6 +515,6 @@
   if(dest_length==0)
     return NULL;
-  unsigned char *ndata = new unsigned char[dest_length*sizeof(unsigned char)+sizeof(GamestateHeader)];
-  unsigned char *dest = ndata + sizeof(GamestateHeader);
+  uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+sizeof(GamestateHeader)];
+  uint8_t *dest = ndata + sizeof(GamestateHeader);
   while(of < GAMESTATE_HEADER(base->data_)->datasize && of < HEADER->datasize){
     *(dest+of)=*(basep+of)^*(gs+of); // do the xor
@@ -516,5 +522,5 @@
   }
   if(GAMESTATE_HEADER(base->data_)->datasize!=HEADER->datasize){
-    unsigned char n=0;
+    uint8_t n=0;
     if(GAMESTATE_HEADER(base->data_)->datasize < HEADER->datasize){
       while(of < dest_length){
