Index: code/branches/netp/src/network/synchronisable/Synchronisable.cc
===================================================================
--- code/branches/netp/src/network/synchronisable/Synchronisable.cc	(revision 2795)
+++ code/branches/netp/src/network/synchronisable/Synchronisable.cc	(revision 2822)
@@ -66,5 +66,7 @@
       objectID=OBJECTID_UNKNOWN;
     classID = static_cast<uint32_t>(-1);
-
+    
+    // set dataSize to 0
+    this->dataSize_ = 0;
     // set standard priority
     this->setPriority( priority::normal );
@@ -251,26 +253,30 @@
     assert(this->classID==this->getIdentifier()->getNetworkID());
     std::list<SynchronisableVariableBase*>::iterator i;
-    uint32_t size;
-    size=getSize(id, mode);
 
     // start copy header
     SynchronisableHeader header(mem);
-    header.setDataSize( size );
+    mem += SynchronisableHeader::getSize();
+    // end copy header
+
+
+    COUT(5) << "Synchronisable getting data from objectID: " << objectID << " classID: " << classID << std::endl;
+    // copy to location
+    for(i=syncList.begin(); i!=syncList.end(); ++i){
+      tempsize += (*i)->getData( mem, mode );
+      //tempsize += (*i)->getSize( mode );
+    }
+    
+    tempsize += SynchronisableHeader::getSize();
     header.setObjectID( this->objectID );
     header.setCreatorID( this->creatorID );
     header.setClassID( this->classID );
     header.setDataAvailable( true );
-    tempsize += SynchronisableHeader::getSize();
-    mem += SynchronisableHeader::getSize();
-    // end copy header
-
-
-    COUT(5) << "Synchronisable getting data from objectID: " << objectID << " classID: " << classID << " length: " << size << std::endl;
-    // copy to location
-    for(i=syncList.begin(); i!=syncList.end(); ++i){
-      (*i)->getData( mem, mode );
-      tempsize += (*i)->getSize( mode );
-    }
+    header.setDataSize( tempsize );
+    
+#ifndef NDEBUG
+    uint32_t size;
+    size=getSize(id, mode);
     assert(tempsize==size);
+#endif
     return true;
   }
@@ -325,10 +331,12 @@
   uint32_t Synchronisable::getSize(int32_t id, uint8_t mode){
     int tsize=SynchronisableHeader::getSize();
-    if(mode==0x0)
+    if (mode==0x0)
       mode=state_;
-    if(!doSync(id, mode))
+    if (!doSync(id, mode))
       return 0;
+    assert( mode==state_ );
+    tsize += this->dataSize_;
     std::list<SynchronisableVariableBase*>::iterator i;
-    for(i=syncList.begin(); i!=syncList.end(); i++){
+    for(i=stringList.begin(); i!=stringList.end(); ++i){
       tsize += (*i)->getSize( mode );
     }
Index: code/branches/netp/src/network/synchronisable/Synchronisable.h
===================================================================
--- code/branches/netp/src/network/synchronisable/Synchronisable.h	(revision 2795)
+++ code/branches/netp/src/network/synchronisable/Synchronisable.h	(revision 2822)
@@ -36,4 +36,5 @@
 #include <queue>
 #include <cassert>
+#include <string>
 #include "util/Math.h"
 #include "util/mbool.h"
@@ -139,5 +140,5 @@
     Synchronisable(BaseObject* creator);
     template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
-    template <class T> void unregisterVariable(T& var);
+    //template <class T> void unregisterVariable(T& var);
     void setObjectMode(uint8_t mode);
     void setPriority(unsigned int freq){ objectFrequency_ = freq; }
@@ -156,4 +157,6 @@
 
     std::list<SynchronisableVariableBase*> syncList;
+    std::list<SynchronisableVariableBase*> stringList;
+    uint32_t dataSize_; //size of all variables except strings
     static uint8_t state_; // detemines wheter we are server (default) or client
     bool backsync_; // if true the variables with mode > 1 will be synchronised to server (client -> server)
@@ -164,29 +167,8 @@
   };
 
-  template <class T> void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
-  {
-    if (bidirectional)
-      syncList.push_back(new SynchronisableVariableBidirectional<const T>(variable, mode, cb));
-    else
-      syncList.push_back(new SynchronisableVariable<const T>(variable, mode, cb));
-  }
-
-  template <class T> void Synchronisable::unregisterVariable(T& var){
-    std::list<SynchronisableVariableBase*>::iterator it = syncList.begin();
-    while(it!=syncList.end()){
-      if( ((*it)->getReference()) == &var ){
-        delete (*it);
-        syncList.erase(it);
-        return;
-      }
-      else
-        it++;
-    }
-    bool unregistered_nonexistent_variable = false;
-    assert(unregistered_nonexistent_variable); //if we reach this point something went wrong:
-    // the variable has not been registered before
-  }
-
   // ================= Specialisation declarations
+  
+//   template <> _NetworkExport void Synchronisable::registerVariable( const std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional);
+  template <> _NetworkExport void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional);
   template <> _NetworkExport void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
   template <> _NetworkExport void Synchronisable::registerVariable( ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
@@ -200,4 +182,34 @@
   template <> _NetworkExport void Synchronisable::registerVariable( const Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
   template <> _NetworkExport void Synchronisable::registerVariable( Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
+  
+  template <class T> void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
+  {
+    if (bidirectional)
+      syncList.push_back(new SynchronisableVariableBidirectional<const T>(variable, mode, cb));
+    else
+      syncList.push_back(new SynchronisableVariable<const T>(variable, mode, cb));
+    if ( this->state_ == mode )
+      this->dataSize_ += syncList.back()->getSize(state_);
+  }
+  
+
+
+//   template <class T> void Synchronisable::unregisterVariable(T& var){
+//     std::list<SynchronisableVariableBase*>::iterator it = syncList.begin();
+//     while(it!=syncList.end()){
+//       if( ((*it)->getReference()) == &var ){
+//         delete (*it);
+//         syncList.erase(it);
+//         return;
+//       }
+//       else
+//         it++;
+//     }
+//     bool unregistered_nonexistent_variable = false;
+//     assert(unregistered_nonexistent_variable); //if we reach this point something went wrong:
+//     // the variable has not been registered before
+//   }
+
+  
 }
 
Index: code/branches/netp/src/network/synchronisable/SynchronisableSpecialisations.cc
===================================================================
--- code/branches/netp/src/network/synchronisable/SynchronisableSpecialisations.cc	(revision 2795)
+++ code/branches/netp/src/network/synchronisable/SynchronisableSpecialisations.cc	(revision 2822)
@@ -29,4 +29,5 @@
 
 #include "network/synchronisable/Synchronisable.h"
+#include <string>
 
 // ================ template spezialisation
@@ -34,4 +35,22 @@
   
 namespace orxonox{
+  
+//   template <> void Synchronisable::registerVariable( const std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
+//   {
+//     if (bidirectional)
+//       syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb));
+//     else
+//       syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb));
+//     stringList.push_back(syncList.back());
+//   }
+  
+  template <> void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
+  {
+    if (bidirectional)
+      syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb));
+    else
+      syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb));
+    stringList.push_back(syncList.back());
+  }
   
   template <> void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
Index: code/branches/netp/src/network/synchronisable/SynchronisableVariable.h
===================================================================
--- code/branches/netp/src/network/synchronisable/SynchronisableVariable.h	(revision 2795)
+++ code/branches/netp/src/network/synchronisable/SynchronisableVariable.h	(revision 2822)
@@ -56,5 +56,5 @@
   {
     public:
-      virtual void getData(uint8_t*& mem, uint8_t mode)=0;
+      virtual uint32_t getData(uint8_t*& mem, uint8_t mode)=0;
       virtual void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false)=0;
       virtual uint32_t getSize(uint8_t mode)=0;
@@ -74,5 +74,5 @@
 
       virtual inline uint8_t getMode(){ return mode_; }
-      virtual inline void getData(uint8_t*& mem, uint8_t mode);
+      virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode);
       virtual inline void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false);
       virtual inline uint32_t getSize(uint8_t mode);
@@ -97,5 +97,5 @@
       
       virtual inline uint8_t getMode(){ return 0x3; } //this basically is a hack ^^
-      virtual inline void getData(uint8_t*& mem, uint8_t mode);
+      virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode);
       virtual void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false);
       virtual inline uint32_t getSize(uint8_t mode);
@@ -122,8 +122,13 @@
   }
 
-  template <class T> inline void SynchronisableVariable<T>::getData(uint8_t*& mem, uint8_t mode)
+  template <class T> inline uint32_t SynchronisableVariable<T>::getData(uint8_t*& mem, uint8_t mode)
   {
     if ( state_ == this->mode_ )
+    {
       getAndIncrease( mem );
+      return returnSize();
+    }
+    else
+      return 0;
 //   mem += SynchronisableVariable<T>::getSize();
   }
@@ -230,5 +235,5 @@
     }
 
-    template <class T> void SynchronisableVariableBidirectional<T>::getData(uint8_t*& mem, uint8_t mode)
+    template <class T> uint32_t SynchronisableVariableBidirectional<T>::getData(uint8_t*& mem, uint8_t mode)
     {
       if ( this->mode_ == mode )
@@ -246,4 +251,5 @@
       SynchronisableVariable<T>::getAndIncrease( mem );
 //   mem += SynchronisableVariable<T>::getSize();
+      return SynchronisableVariableBidirectional::getSize(mode);
     }
 
