Index: /branches/network/src/lib/network/synchronizeable.cc
===================================================================
--- /branches/network/src/lib/network/synchronizeable.cc	(revision 7511)
+++ /branches/network/src/lib/network/synchronizeable.cc	(revision 7512)
@@ -49,5 +49,5 @@
     this->setUniqueID(SharedNetworkData::getInstance()->getNewUniqueID());
   }
-  
+
   this->registerVar( new SynchronizeableString( &this->objectName, &this->objectName, "objectName" ) );
 }
@@ -101,19 +101,19 @@
   if ( sentStates.size() <= userId )
     sentStates.resize( userId+1 );
-  
+
   //calculate needed memory
   int neededSize = 0;
-  
+
   for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
     neededSize += (*it)->getSize();
-  
+
   assert( neededSize <= maxLength );
-  
+
   //remove older states from history than fromStateId
   StateHistory::iterator it = sentStates[userId].begin();
-  
+
   while ( it != sentStates[userId].end() && (*it)->stateId < fromStateId )
     it++;
-  
+
   if ( it != sentStates[userId].begin() )
   {
@@ -128,36 +128,36 @@
     sentStates[userId].erase( sentStates[userId].begin(), it );
   }
-  
+
   //find state to create diff from
   StateHistoryEntry * stateFrom = NULL;
-  
+
   it = sentStates[userId].begin();
   while ( it != sentStates[userId].end() && (*it)->stateId != fromStateId )
     it++;
-  
+
   if ( it == sentStates[userId].end() )
   {
     StateHistoryEntry * initialEntry = new StateHistoryEntry();
-    
+
     initialEntry->stateId = fromStateId;
     initialEntry->dataLength = 0;
     initialEntry->data = NULL;
-    
+
     stateFrom = initialEntry;
   }
   else
     stateFrom = (*it);
-  
+
   StateHistoryEntry * stateTo = new StateHistoryEntry();
-    
+
   stateTo->stateId = stateId;
   stateTo->dataLength = neededSize;
   stateTo->data = (byte*)malloc( neededSize );
-  
+
   std::list<int>::iterator sizeIter = stateFrom->sizeList.begin();
-  
+
   int i = 0;
   int n;
-  
+
   for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
   {
@@ -178,11 +178,11 @@
       stateTo->sizeList.push_back( (*sizeIter) );
     }
-    
+
     if ( sizeIter != stateFrom->sizeList.end() )
       sizeIter++;
   }
-  
+
   sentStates[userId].push_back( stateTo );
-  
+
   //write diff to data
   for ( i = 0; i<neededSize; i++ )
@@ -193,5 +193,5 @@
       data[i] = stateTo->data[i];
   }
-  
+
   return neededSize;
 }
@@ -203,4 +203,5 @@
  * @param length length of diff
  * @param stateId id of current state
+ * @param fromStateId id of the base state id
  * @return true on success
  */
@@ -210,5 +211,5 @@
   if ( recvStates.size() <= userId )
     recvStates.resize( userId+1 );
-  
+
   //create new state
   StateHistoryEntry * stateTo = new StateHistoryEntry();
@@ -216,11 +217,11 @@
   stateTo->dataLength = length;
   stateTo->data = (byte*)malloc( length );
-  
-  //remove old states 
+
+  //remove old states
   StateHistory::iterator it = recvStates[userId].begin();
-  
+
   while ( it != recvStates[userId].end() && (*it)->stateId < fromStateId )
     it++;
-  
+
   if ( it != recvStates[userId].begin() )
   {
@@ -235,25 +236,25 @@
     recvStates[userId].erase( recvStates[userId].begin(), it );
   }
-  
+
   //find state to apply diff to
   StateHistoryEntry * stateFrom = NULL;
-  
+
   it = recvStates[userId].begin();
   while ( it != recvStates[userId].end() && (*it)->stateId != fromStateId )
     it++;
-  
+
   if ( it == recvStates[userId].end() )
   {
     StateHistoryEntry * initialEntry = new StateHistoryEntry();
-    
+
     initialEntry->stateId = fromStateId;
     initialEntry->dataLength = 0;
     initialEntry->data = NULL;
-    
+
     stateFrom = initialEntry;
   }
   else
     stateFrom = (*it);
-  
+
   //apply diff
   for ( int i = 0; i<length; i++ )
@@ -264,17 +265,17 @@
       stateTo->data[i] = data[i];
   }
-  
+
   //add state to state history
   recvStates[userId].push_back( stateTo );
-  
-  int i = 0; 
-  
+
+  int i = 0;
+
   for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
   {
     i += (*it)->readFromBuf( stateTo->data + i, stateTo->dataLength - i );
   }
-  
+
   assert( i == length -1 );
-  
+
   return length;
 }
