Index: code/branches/netp2/src/network/FunctionCallManager.cc
===================================================================
--- code/branches/netp2/src/network/FunctionCallManager.cc	(revision 2943)
+++ code/branches/netp2/src/network/FunctionCallManager.cc	(revision 2944)
@@ -57,6 +57,9 @@
 {
   std::map<uint32_t, packet::FunctionCalls*>::iterator it;
-  for (it = FunctionCallManager::clientMap_.begin(); it != FunctionCallManager::clientMap_.end(); it++)
+  for (it = FunctionCallManager::clientMap_.begin(); it != FunctionCallManager::clientMap_.end(); )
+  {
     it->second->send();
+    clientMap_.erase(it++);
+  }
 }
 
Index: code/branches/netp2/src/network/NetworkFunction.cc
===================================================================
--- code/branches/netp2/src/network/NetworkFunction.cc	(revision 2943)
+++ code/branches/netp2/src/network/NetworkFunction.cc	(revision 2944)
@@ -58,9 +58,10 @@
   
   
-  NetworkFunctionStatic::NetworkFunctionStatic(Functor* functor, std::string name, const NetworkFunctionPointer& p):
+  NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, std::string name, const NetworkFunctionPointer& p):
     NetworkFunctionBase(name)
   {
     RegisterObject(NetworkFunctionStatic);
     
+    this->functor_ = functor;
     functorMap_[p] = this;
     idMap_[ this->getNetworkID() ] = this;
Index: code/branches/netp2/src/network/NetworkFunction.h
===================================================================
--- code/branches/netp2/src/network/NetworkFunction.h	(revision 2943)
+++ code/branches/netp2/src/network/NetworkFunction.h	(revision 2944)
@@ -77,10 +77,11 @@
     static inline bool  isStatic( uint32_t networkID )  { return isStaticMap_[networkID]; }
     
-    
     static inline void setNetworkID(std::string name, uint32_t id){ assert( nameMap_.find(name)!=nameMap_.end() ); nameMap_[name]->setNetworkID(id); }
     
+  protected:
+    static std::map<uint32_t, bool> isStaticMap_;
+    
   private:
     static std::map<std::string, NetworkFunctionBase*> nameMap_;
-    static std::map<uint32_t, bool> isStaticMap_;
     uint32_t networkID_;
     std::string name_;
@@ -91,5 +92,5 @@
 class _NetworkExport NetworkFunctionStatic: public NetworkFunctionBase {
   public:
-    NetworkFunctionStatic(Functor* functor, std::string name, const NetworkFunctionPointer& p);
+    NetworkFunctionStatic(FunctorStatic* functor, std::string name, const NetworkFunctionPointer& p);
     ~NetworkFunctionStatic();
     
@@ -152,4 +153,9 @@
     FunctorMember<T>* functor_;
 };
+
+template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, std::string name, const NetworkFunctionPointer& p):
+    NetworkMemberFunctionBase(name, p), functor_(functor)
+{
+}
 
 
Index: code/branches/netp2/src/network/Server.cc
===================================================================
--- code/branches/netp2/src/network/Server.cc	(revision 2943)
+++ code/branches/netp2/src/network/Server.cc	(revision 2944)
@@ -60,4 +60,7 @@
 #include "util/Convert.h"
 #include "ChatListener.h"
+#include "FunctionCallManager.h"
+#include "packet/FunctionIDs.h"
+
 
 namespace orxonox
@@ -157,4 +160,5 @@
       gamestates_->processGamestates();
       updateGamestate();
+      FunctionCallManager::sendCalls();
     }
   }
@@ -340,11 +344,19 @@
       return false;
     }
-    COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
+    COUT(5) << "Con.Man: creating client id: " << temp->getID() << std::endl;
+    
+    // synchronise class ids
     connection->syncClassid(temp->getID());
+    
+    // now synchronise functionIDs
+    packet::FunctionIDs *fIDs = new packet::FunctionIDs();
+    bool b = fIDs->send();
+    assert(b);
+    
     temp->setSynched(true);
-    COUT(3) << "sending welcome" << std::endl;
+    COUT(4) << "sending welcome" << std::endl;
     packet::Welcome *w = new packet::Welcome(temp->getID(), temp->getShipID());
     w->setClientID(temp->getID());
-    bool b = w->send();
+    b = w->send();
     assert(b);
     packet::Gamestate *g = new packet::Gamestate();
Index: code/branches/netp2/src/network/packet/FunctionCalls.cc
===================================================================
--- code/branches/netp2/src/network/packet/FunctionCalls.cc	(revision 2943)
+++ code/branches/netp2/src/network/packet/FunctionCalls.cc	(revision 2944)
@@ -72,11 +72,11 @@
   {
     uint32_t functionID = *(uint32_t*)temp;
-    bool isStatic = NetworkFunctionBase::isStatic( functionID );
+    bool isStatic = *(uint8_t*)(temp+sizeof(uint32_t));
     if( isStatic )
     {
       MultiType mt1, mt2, mt3, mt4, mt5;
       NetworkFunctionStatic *fct = NetworkFunctionStatic::getFunction( functionID );
-      uint32_t nrOfArguments = *(uint32_t*)(temp+sizeof(uint32_t));
-      temp+=2*sizeof(uint32_t);
+      uint32_t nrOfArguments = *(uint32_t*)(temp+sizeof(uint32_t)+sizeof(uint8_t));
+      temp+=2*sizeof(uint32_t)+sizeof(uint8_t);
       switch(nrOfArguments)
       {
@@ -122,7 +122,7 @@
       MultiType mt1, mt2, mt3, mt4, mt5;
       NetworkMemberFunctionBase *fct = NetworkMemberFunctionBase::getFunction( functionID );
-      uint32_t nrOfArguments = *(uint32_t*)(temp+sizeof(uint32_t));
-      uint32_t objectID = *(uint32_t*)(temp+2*sizeof(uint32_t));
-      temp+=3*sizeof(uint32_t);
+      uint32_t nrOfArguments = *(uint32_t*)(temp+sizeof(uint32_t)+sizeof(uint8_t));
+      uint32_t objectID = *(uint32_t*)(temp+2*sizeof(uint32_t)+sizeof(uint8_t));
+      temp+=3*sizeof(uint32_t)+sizeof(uint8_t);
       switch(nrOfArguments)
       {
@@ -166,4 +166,5 @@
     }
   }
+  delete this;
   return true;
 }
@@ -173,5 +174,5 @@
   
   // first determine the size that has to be reserved for this call
-  uint32_t callsize = 2*sizeof(uint32_t); //size for network-function-id and nrOfArguments
+  uint32_t callsize = 2*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and for bool isStatic
   uint32_t nrOfArguments = 0;
   if(mt1)
@@ -211,10 +212,11 @@
   }
   
-  // now serialise the mt values and copy the function id
+  // now serialise the mt values and copy the function id and isStatic
   uint8_t* temp = data_+currentSize_;
   *(uint32_t*)(data_+sizeof(uint32_t)) = *(uint32_t*)(data_+sizeof(uint32_t))+1; // increase number of calls
   *(uint32_t*)temp = networkID;
-  *(uint32_t*)(temp+sizeof(uint32_t)) = nrOfArguments;
-  temp += 2*sizeof(uint32_t);
+  *(uint8_t*)(temp+sizeof(uint32_t)) = true;
+  *(uint32_t*)(temp+sizeof(uint32_t)+sizeof(uint8_t)) = nrOfArguments;
+  temp += 2*sizeof(uint32_t)+sizeof(uint8_t);
   if(mt1)
   {
@@ -237,5 +239,6 @@
     }
   }
-  currentSize_ += callsize;
+  //currentSize_ += callsize;
+  currentSize_ = temp-data_;
   
 }
@@ -245,5 +248,5 @@
   
   // first determine the size that has to be reserved for this call
-  uint32_t callsize = 3*sizeof(uint32_t); //size for network-function-id and nrOfArguments and the objectID
+  uint32_t callsize = 3*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and the objectID
   uint32_t nrOfArguments = 0;
   if(mt1)
@@ -287,7 +290,8 @@
   *(uint32_t*)(data_+sizeof(uint32_t)) = *(uint32_t*)(data_+sizeof(uint32_t))+1; // increase number of calls
   *(uint32_t*)temp = networkID;
-  *(uint32_t*)(temp+sizeof(uint32_t)) = nrOfArguments;
-  *(uint32_t*)(temp+2*sizeof(uint32_t)) = objectID;
-  temp += 3*sizeof(uint32_t);
+  *(uint8_t*)(temp+sizeof(uint32_t)) = false;
+  *(uint32_t*)(temp+sizeof(uint32_t)+sizeof(uint8_t)) = nrOfArguments;
+  *(uint32_t*)(temp+2*sizeof(uint32_t)+sizeof(uint8_t)) = objectID;
+  temp += 3*sizeof(uint32_t)+sizeof(uint8_t);
   if(mt1)
   {
Index: code/branches/netp2/src/network/packet/Packet.cc
===================================================================
--- code/branches/netp2/src/network/packet/Packet.cc	(revision 2943)
+++ code/branches/netp2/src/network/packet/Packet.cc	(revision 2944)
@@ -39,9 +39,11 @@
 
 #include "Acknowledgement.h"
+#include "DeleteObjects.h"
 #include "Chat.h"
 #include "ClassID.h"
+#include "FunctionCalls.h"
+#include "FunctionIDs.h"
 #include "Gamestate.h"
 #include "Welcome.h"
-#include "DeleteObjects.h"
 #include "network/Host.h"
 #include "core/CoreIncludes.h"
@@ -172,31 +174,39 @@
   unsigned int clientID = ClientInformation::findClient(&peer->address)->getID();
   Packet *p = 0;
-  COUT(5) << "packet type: " << *(ENUM::Type *)&data[_PACKETID] << std::endl;
+  COUT(6) << "packet type: " << *(ENUM::Type *)&data[_PACKETID] << std::endl;
   switch( *(ENUM::Type *)(data + _PACKETID) )
   {
     case ENUM::Acknowledgement:
-      COUT(4) << "ack" << std::endl;
+      COUT(5) << "ack" << std::endl;
       p = new Acknowledgement( data, clientID );
       break;
     case ENUM::Chat:
-      COUT(4) << "chat" << std::endl;
+      COUT(5) << "chat" << std::endl;
       p = new Chat( data, clientID );
       break;
     case ENUM::ClassID:
-      COUT(4) << "classid" << std::endl;
+      COUT(5) << "classid" << std::endl;
       p = new ClassID( data, clientID );
       break;
     case ENUM::Gamestate:
-      COUT(4) << "gamestate" << std::endl;
+      COUT(5) << "gamestate" << std::endl;
       // TODO: remove brackets
       p = new Gamestate( data, clientID );
       break;
     case ENUM::Welcome:
-      COUT(4) << "welcome" << std::endl;
+      COUT(5) << "welcome" << std::endl;
       p = new Welcome( data, clientID );
       break;
     case ENUM::DeleteObjects:
-      COUT(4) << "deleteobjects" << std::endl;
+      COUT(5) << "deleteobjects" << std::endl;
       p = new DeleteObjects( data, clientID );
+      break;
+    case ENUM::FunctionCalls:
+      COUT(5) << "functionCalls" << std::endl;
+      p = new FunctionCalls( data, clientID );
+      break;
+    case ENUM::FunctionIDs:
+      COUT(5) << "functionIDs" << std::endl;
+      p = new FunctionIDs( data, clientID );
       break;
     default:
Index: code/branches/netp2/src/network/synchronisable/SynchronisableVariable.h
===================================================================
--- code/branches/netp2/src/network/synchronisable/SynchronisableVariable.h	(revision 2943)
+++ code/branches/netp2/src/network/synchronisable/SynchronisableVariable.h	(revision 2944)
@@ -268,6 +268,5 @@
         else{
           // apply data
-          mem += sizeof(varReference_);
-          if ( checkEquality( this->variable_, mem )==true )
+          if ( checkEquality( this->variable_, mem+sizeof(varReference_) )==true )
           {
             mem += getSize( mode );
@@ -276,4 +275,5 @@
           else
           {
+            mem += sizeof(varReference_);
             memcpy((void*)&this->varBuffer_, &this->variable_, sizeof(T));
             if ( this->callback_ != 0 )
Index: code/branches/netp2/src/orxonox/objects/Test.cc
===================================================================
--- code/branches/netp2/src/orxonox/objects/Test.cc	(revision 2943)
+++ code/branches/netp2/src/orxonox/objects/Test.cc	(revision 2944)
@@ -82,9 +82,9 @@
 
 
-	void Test::registerVariables()
-	{
-		registerVariable ( u1, variableDirection::toclient, new NetworkCallback<Test> ( this, &Test::checkU1 ));
+  void Test::registerVariables()
+  {
+    registerVariable ( u1, variableDirection::toclient, new NetworkCallback<Test> ( this, &Test::checkU1 ));
     registerVariable ( u2, variableDirection::toserver, new NetworkCallback<Test> ( this, &Test::checkU2 ));
-		registerVariable ( u3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkU3 ), true );
+    registerVariable ( u3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkU3 ), true );
     registerVariable ( u4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkU4 ), true );
     
@@ -93,8 +93,9 @@
     registerVariable ( s3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkS3 ), true );
     registerVariable ( s4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkS4 ), true );
-	}
+  }
   
   void Test::call(unsigned int clientID)
   {
+    callStaticNetworkFunction( &Test::printV1, clientID );
     callStaticNetworkFunction( &Test::printV1, clientID );
   }
Index: code/branches/netp2/src/orxonox/objects/Test.h
===================================================================
--- code/branches/netp2/src/orxonox/objects/Test.h	(revision 2943)
+++ code/branches/netp2/src/orxonox/objects/Test.h	(revision 2944)
@@ -50,5 +50,5 @@
       void registerVariables();
       
-      void call(unsigned int clientID);
+      static void call(unsigned int clientID);
 
 
