Index: branches/network/src/lib/network/synchronizeable.cc
===================================================================
--- branches/network/src/lib/network/synchronizeable.cc	(revision 7558)
+++ branches/network/src/lib/network/synchronizeable.cc	(revision 7559)
@@ -89,8 +89,14 @@
 /**
  * get the diff to last acked state of userId
+ *
+ * each synchrinizeable defines its own stack of states received and sent over the network. The stack contains
+ * a per user entry for the last sent/received state This function returns a delta compressed state of the
+ * synchronizeable. This state will be transmitted over the network to the other participants
+ *
  * @param userId user to create diff for
  * @param data buffer to copy diff in
  * @param maxLength max bytes to copy into data
  * @param stateId id of current state
+ * @param fromStateId the reference state for the delta state
  * @param priorityTH tells getStateDiff to not send element with priority \< priorityTH
  * @return n bytes copied into data
@@ -115,6 +121,6 @@
   while ( it != sentStates[userId].end() && (*it)->stateId < fromStateId )
     it++;
-
-  if ( it != sentStates[userId].begin() )
+  ///FIXED: altered begin() -> end()
+  if ( it != sentStates[userId].end() )
   {
     for ( StateHistory::iterator it2 = sentStates[userId].begin(); it2 != it; it2++ )
@@ -160,4 +166,5 @@
   int n;
 
+  // now do the actual synchronization: kick all variables to write into a common buffer
   for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
   {
Index: branches/network/src/lib/network/synchronizeable.h
===================================================================
--- branches/network/src/lib/network/synchronizeable.h	(revision 7558)
+++ branches/network/src/lib/network/synchronizeable.h	(revision 7559)
@@ -58,13 +58,13 @@
     void setIsServer( bool isServer );
     bool isServer();
-    
+
     virtual void varChangeHandler( std::list<int> & id );
-    
+
     int getStateDiff( int userId, byte* data, int maxLength, int stateId, int fromStateId, int priorityTH );
     bool setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId );
-    
+
     void registerVar( SynchronizeableVar * var );
     int registerVarId( SynchronizeableVar * var );
-    
+
     inline void setUniqueID( int id ){ uniqueID = id; }
     inline int  getUniqueID() const { return uniqueID; }
@@ -74,5 +74,5 @@
     inline void setOwner(int owner){ this->owner = owner; }
 
-    /** @returns true if this Synchronizeable has to be synchronized over network */
+    /** @returns true if this Synchronizeable wants to be synchronized over network */
     inline bool beSynchronized() { return this->bSynchronize; }
     /** @param bSynchronize sets the Synchronizeable to be sunchronized or not */
@@ -92,9 +92,9 @@
     int               hostID;         //!< my own host id
     bool              bSynchronize;   //!< do we need beeing synchronized?
-    
+
     SyncVarList       syncVarList;    //!< list containing variables to synchronize
-    
-    UserStateHistory  sentStates;     //!< store already sent states to create diffs from
-    UserStateHistory  recvStates;     //!< store recieved states to apply diffs
+
+    UserStateHistory  sentStates;     //!< store already sent states to create diffs from, offset corresponds to the user id
+    UserStateHistory  recvStates;     //!< store recieved states to apply diffs, offset corresponds to the user id
 
 };
Index: branches/network/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc
===================================================================
--- branches/network/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc	(revision 7558)
+++ branches/network/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc	(revision 7559)
@@ -46,23 +46,23 @@
   int n = 0;
   int res;
-  
-  res = Converter::floatToByteArray( vPtrIn->v.x, buf, maxLength - n );
+
+  res = Converter::floatToByteArray( vPtrIn->v.x, buf + n, maxLength - n );
   assert( res > 0 );
   n += res;
-  
-  res = Converter::floatToByteArray( vPtrIn->v.y, buf, maxLength - n );
+
+  res = Converter::floatToByteArray( vPtrIn->v.y, buf + n, maxLength - n );
   assert( res > 0 );
   n += res;
-  
-  res = Converter::floatToByteArray( vPtrIn->v.z, buf, maxLength - n );
+
+  res = Converter::floatToByteArray( vPtrIn->v.z, buf + n, maxLength - n );
   assert( res > 0 );
   n += res;
-  
-  res = Converter::floatToByteArray( vPtrIn->w, buf, maxLength - n );
+
+  res = Converter::floatToByteArray( vPtrIn->w, buf +  n, maxLength - n );
   assert( res > 0 );
   n += res;
-  
+
   assert( 4*FLOATSIZE == n );
-  
+
   return n;
 }
@@ -77,28 +77,28 @@
 {
   assert( maxLength >= 4*FLOATSIZE );
-  
+
   float x,y,z,w;
-  
+
   int res;
   int n = 0;
-  
+
   res += Converter::byteArrayToFloat( buf + n, &x );
   assert( res > 0 );
   n += res;
-  
+
   res += Converter::byteArrayToFloat( buf + n, &x );
   assert( res > 0 );
   n += res;
-  
+
   res += Converter::byteArrayToFloat( buf + n, &x );
   assert( res > 0 );
   n += res;
-  
+
   res += Converter::byteArrayToFloat( buf + n, &w );
   assert( res > 0 );
   n += res;
-  
+
   *vPtrOut = Quaternion( Vector(x, y, z), w );
-  
+
   assert( res == 4*FLOATSIZE );
   return res;
Index: branches/network/src/lib/network/synchronizeable_var/synchronizeable_var.cc
===================================================================
--- branches/network/src/lib/network/synchronizeable_var/synchronizeable_var.cc	(revision 7558)
+++ branches/network/src/lib/network/synchronizeable_var/synchronizeable_var.cc	(revision 7559)
@@ -18,4 +18,5 @@
 
 
+
 /**
  * standard constructor
@@ -26,5 +27,5 @@
   assert( ptrIn );
   assert( ptrOut );
-  
+
   this->ptrIn = ptrIn;
   this->ptrOut = ptrOut;
@@ -32,5 +33,5 @@
   this->permission = permission;
   this->priority = priority;
-  this->real_priority = priority;
+  this->realPriority = priority;
   this->name = name;
 }
Index: branches/network/src/lib/network/synchronizeable_var/synchronizeable_var.h
===================================================================
--- branches/network/src/lib/network/synchronizeable_var/synchronizeable_var.h	(revision 7558)
+++ branches/network/src/lib/network/synchronizeable_var/synchronizeable_var.h	(revision 7559)
@@ -9,4 +9,5 @@
 #include <string>
 #include "netdefs.h"
+#include <assert.h>
 
 class SynchronizeableVar {
@@ -15,5 +16,5 @@
     SynchronizeableVar( void * ptrIn, void * ptrOut, std::string name, int length, int permission = 0, int priority = 0 );
     virtual ~SynchronizeableVar();
-    
+
     /**
      * check if synchronizeable wants to be informed on changes
@@ -21,5 +22,5 @@
      */
     inline bool beWatched(){ return this->bWatched; }
-    
+
     /**
      * write var data to byte buffer
@@ -29,5 +30,5 @@
      */
     virtual int writeToBuf( byte * buf, int maxLength ) = 0;
-    
+
     /**
      * read var data from byte buffer
@@ -37,5 +38,5 @@
      */
     virtual int readFromBuf( byte * buf, int maxLength ) = 0;
-    
+
     /**
      * check if writeToBuf will return the same size every time
@@ -43,5 +44,5 @@
      */
     virtual bool hasStaticSize() = 0;
-    
+
     /**
      * get size writeToBuf needs
@@ -49,5 +50,5 @@
      */
     virtual int getSize(){ return length; }
-    
+
     /**
      * check for permission to write
@@ -55,5 +56,5 @@
      */
     inline bool checkPremission( int permission ){ return (permission & this->permission) != 0; }
-    
+
     /**
      * get variable name
@@ -61,5 +62,5 @@
      */
     inline std::string getName(){ return name; }
-    
+
     /**
      * set variable name
@@ -67,5 +68,5 @@
      */
     inline void setName( std::string name ) { this->name = name; }
-    
+
     /**
      * get priority
@@ -73,5 +74,5 @@
      */
     inline int getPriority() { return this->priority; }
-    
+
     /**
      * set priority
@@ -79,9 +80,9 @@
      */
     inline void setPriority( int p ) { this->priority = p; }
-    
+
     /**
      * reset priority to variable specific default value
      */
-    inline void resetPriority() { this->priority = this->real_priority; }
+    inline void resetPriority() { this->priority = this->realPriority; }
 
 
@@ -95,7 +96,7 @@
     int permission;     //!< who is allowed to change this var
     int priority;       //!< priority assigned to var
-    int real_priority;  //!< priority assigned to var, increased every time not sent
-    
-    
+    int realPriority;  //!< priority assigned to var, increased every time not sent
+
+
     std::string name;    //!< variable name (for debugging)
 
Index: branches/network/src/lib/network/synchronizeable_var/synchronizeable_vector.cc
===================================================================
--- branches/network/src/lib/network/synchronizeable_var/synchronizeable_vector.cc	(revision 7558)
+++ branches/network/src/lib/network/synchronizeable_var/synchronizeable_vector.cc	(revision 7559)
@@ -47,19 +47,19 @@
   int n = 0;
   int res;
-  
-  res = Converter::floatToByteArray( vPtrIn->x, buf, maxLength - n );
+
+  res = Converter::floatToByteArray( vPtrIn->x, buf + n, maxLength - n );
   assert( res > 0 );
   n += res;
-  
-  res = Converter::floatToByteArray( vPtrIn->y, buf, maxLength - n );
+
+  res = Converter::floatToByteArray( vPtrIn->y, buf + n, maxLength - n );
   assert( res > 0 );
   n += res;
-  
-  res = Converter::floatToByteArray( vPtrIn->z, buf, maxLength - n );
+
+  res = Converter::floatToByteArray( vPtrIn->z, buf + n, maxLength - n );
   assert( res > 0 );
   n += res;
-  
+
   assert( 3*FLOATSIZE == n );
-  
+
   return n;
 }
@@ -74,24 +74,24 @@
 {
   assert( maxLength >= 3*FLOATSIZE );
-  
+
   float x,y,z;
-  
+
   int res;
   int n = 0;
-  
+
   res += Converter::byteArrayToFloat( buf + n, &x );
   assert( res > 0 );
   n += res;
-  
+
   res += Converter::byteArrayToFloat( buf + n, &x );
   assert( res > 0 );
   n += res;
-  
+
   res += Converter::byteArrayToFloat( buf + n, &x );
   assert( res > 0 );
   n += res;
-  
+
   *vPtrOut = Vector( x, y, z );
-  
+
   assert( res == 3*FLOATSIZE );
   return res;
