Index: /code/branches/core7/src/libraries/network/FunctionCall.cc
===================================================================
--- /code/branches/core7/src/libraries/network/FunctionCall.cc	(revision 10470)
+++ /code/branches/core7/src/libraries/network/FunctionCall.cc	(revision 10471)
@@ -32,4 +32,5 @@
 #include "util/MultiType.h"
 #include "NetworkFunction.h"
+#include "NetworkFunctionManager.h"
 
 namespace orxonox {
@@ -48,5 +49,5 @@
   if( this->bIsStatic_ )
   {
-    NetworkFunctionStatic *fct = NetworkFunctionStatic::getFunction( this->functionID_ );
+    NetworkFunctionStatic *fct = static_cast<NetworkFunctionStatic*>(NetworkFunctionManager::getFunction( this->functionID_ ));
     assert( this->nrOfArguments_==this->arguments_.size() );
     switch(this->nrOfArguments_)
@@ -76,5 +77,5 @@
   else // not a static function, so also handle with the objectID
   {
-    NetworkMemberFunctionBase *fct = NetworkMemberFunctionBase::getFunction( this->functionID_ );
+    NetworkMemberFunctionBase *fct = static_cast<NetworkMemberFunctionBase*>(NetworkFunctionManager::getFunction( this->functionID_ ));
     switch(this->nrOfArguments_)
     {
Index: /code/branches/core7/src/libraries/network/NetworkFunction.cc
===================================================================
--- /code/branches/core7/src/libraries/network/NetworkFunction.cc	(revision 10470)
+++ /code/branches/core7/src/libraries/network/NetworkFunction.cc	(revision 10471)
@@ -32,52 +32,20 @@
 namespace orxonox
 {
-  std::map<NetworkFunctionPointer, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::functorMap_;
-  std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_;
+    NetworkFunctionBase::NetworkFunctionBase(const std::string& name, const NetworkFunctionPointer& p)
+    {
+        static uint32_t networkID = 0;
+        this->networkID_ = networkID++;
 
-  NetworkFunctionBase::NetworkFunctionBase(const std::string& name)
-  {
-    static uint32_t networkID = 0;
-    this->networkID_ = networkID++;
+        this->name_ = name;
+        NetworkFunctionManager::getNameMap()[name] = this;
+        NetworkFunctionManager::getFunctorMap()[p] = this;
+        NetworkFunctionManager::getIdMap()[this->getNetworkID()] = this;
+    }
 
-    this->name_ = name;
-    NetworkFunctionManager::getNameMap()[name] = this;
-  }
-  NetworkFunctionBase::~NetworkFunctionBase()
-  {
-  }
-
-
-  NetworkFunctionStatic::NetworkFunctionStatic(const FunctorStaticPtr& functor, const std::string& name, const NetworkFunctionPointer& p):
-    NetworkFunctionBase(name)
-  {
-    this->functor_ = functor;
-    NetworkFunctionStatic::getFunctorMap()[p] = this;
-    NetworkFunctionStatic::getIdMap()[ this->getNetworkID() ] = this;
-  }
-
-  /*static*/ std::map<NetworkFunctionPointer, NetworkFunctionStatic*>& NetworkFunctionStatic::getFunctorMap()
-  {
-    static std::map<NetworkFunctionPointer, NetworkFunctionStatic*> functorMap_;
-    return functorMap_;
-  }
-
-  /*static*/ std::map<uint32_t, NetworkFunctionStatic*>& NetworkFunctionStatic::getIdMap()
-  {
-    static std::map<uint32_t, NetworkFunctionStatic*> idMap_;
-    return idMap_;
-  }
-
-
-  NetworkMemberFunctionBase::NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p):
-    NetworkFunctionBase(name)
-  {
-    this->functorMap_[p] = this;
-    this->idMap_[ this->getNetworkID() ] = this;
-  }
-
-  NetworkMemberFunctionBase::~NetworkMemberFunctionBase()
-  {
-  }
-
-
+    void NetworkFunctionBase::setNetworkID(uint32_t id)
+    {
+        NetworkFunctionManager::getIdMap().erase(this->networkID_);  // remove old id
+        this->networkID_ = id;
+        NetworkFunctionManager::getIdMap()[this->networkID_] = this; // add new id
+    }
 }
Index: /code/branches/core7/src/libraries/network/NetworkFunction.h
===================================================================
--- /code/branches/core7/src/libraries/network/NetworkFunction.h	(revision 10470)
+++ /code/branches/core7/src/libraries/network/NetworkFunction.h	(revision 10471)
@@ -69,8 +69,8 @@
 class _NetworkExport NetworkFunctionBase {
   public:
-    NetworkFunctionBase(const std::string& name);
-    virtual ~NetworkFunctionBase();
-
-    virtual void        setNetworkID(uint32_t id)       { this->networkID_ = id; }
+    NetworkFunctionBase(const std::string& name, const NetworkFunctionPointer& p);
+    virtual ~NetworkFunctionBase() {}
+
+    void setNetworkID(uint32_t id);
     inline uint32_t     getNetworkID() const            { return this->networkID_; }
     inline const std::string& getName() const           { return name_; }
@@ -85,5 +85,8 @@
 class _NetworkExport NetworkFunctionStatic: public NetworkFunctionBase {
   public:
-    NetworkFunctionStatic(const FunctorStaticPtr& functor, const std::string& name, const NetworkFunctionPointer& p);
+    NetworkFunctionStatic(const FunctorStaticPtr& functor, const std::string& name, const NetworkFunctionPointer& p)
+        : NetworkFunctionBase(name, p)
+        , functor_(functor)
+    { }
 
     inline void call(){ (*this->functor_)(); }
@@ -94,14 +97,5 @@
     inline void call(const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5){ (*this->functor_)(mt1, mt2, mt3, mt4, mt5); }
 
-    virtual void setNetworkID( uint32_t id )
-        { NetworkFunctionBase::setNetworkID( id ); NetworkFunctionStatic::getIdMap()[id] = this; }
-    static NetworkFunctionStatic* getFunction( uint32_t id )
-        { assert( NetworkFunctionStatic::getIdMap().find(id) != NetworkFunctionStatic::getIdMap().end() ); return NetworkFunctionStatic::getIdMap()[id]; }
-    static NetworkFunctionStatic* getFunction( const NetworkFunctionPointer& p )
-        { assert( NetworkFunctionStatic::getFunctorMap().find(p) != NetworkFunctionStatic::getFunctorMap().end() ); return NetworkFunctionStatic::getFunctorMap()[p]; }
-
   private:
-    static std::map<NetworkFunctionPointer, NetworkFunctionStatic*>& getFunctorMap();
-    static std::map<uint32_t, NetworkFunctionStatic*>& getIdMap();
     FunctorStaticPtr functor_;
 
@@ -111,10 +105,7 @@
 class _NetworkExport NetworkMemberFunctionBase: public NetworkFunctionBase {
   public:
-    NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p);
-    ~NetworkMemberFunctionBase();
-
-    virtual void setNetworkID( uint32_t id ){ NetworkFunctionBase::setNetworkID( id ); idMap_[id] = this; }
-    static NetworkMemberFunctionBase* getFunction( uint32_t id ){ assert( idMap_.find(id) != idMap_.end() ); return idMap_[id]; }
-    static NetworkMemberFunctionBase* getFunction( const NetworkFunctionPointer& p ){ assert( functorMap_.find(p) != functorMap_.end() ); return functorMap_[p]; }
+    NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p)
+        : NetworkFunctionBase(name, p)
+    { }
 
     //
@@ -125,8 +116,4 @@
     virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)=0;
     virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)=0;
-
-  private:
-    static std::map<NetworkFunctionPointer, NetworkMemberFunctionBase*> functorMap_;
-    static std::map<uint32_t, NetworkMemberFunctionBase*> idMap_;
 };
 
@@ -134,5 +121,8 @@
 template <class T> class NetworkMemberFunction: public NetworkMemberFunctionBase {
   public:
-    NetworkMemberFunction(const FunctorMemberPtr<T>& functor, const std::string& name, const NetworkFunctionPointer& p);
+    NetworkMemberFunction(const FunctorMemberPtr<T>& functor, const std::string& name, const NetworkFunctionPointer& p)
+        : NetworkMemberFunctionBase(name, p)
+        , functor_(functor)
+    { }
 
     inline bool call(uint32_t objectID)
@@ -200,9 +190,4 @@
     FunctorMemberPtr<T> functor_;
 };
-
-template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(const FunctorMemberPtr<T>& functor, const std::string& name, const NetworkFunctionPointer& p):
-    NetworkMemberFunctionBase(name, p), functor_(functor)
-{
-}
 
 template<class T> inline void copyPtr( T ptr, NetworkFunctionPointer& destptr)
Index: /code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h
===================================================================
--- /code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h	(revision 10470)
+++ /code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h	(revision 10471)
@@ -36,4 +36,5 @@
 
 #include "NetworkFunction.h"
+#include "NetworkFunctionManager.h"
 
 namespace orxonox
@@ -50,5 +51,5 @@
             NetworkFunctionPointer p1; \
             copyPtr( functionPointer, p1 ); \
-            FunctionCallManager::addCallStatic(NetworkFunctionStatic::getFunction(p1)->getNetworkID(), __VA_ARGS__); \
+            FunctionCallManager::addCallStatic(NetworkFunctionManager::getFunction(p1)->getNetworkID(), __VA_ARGS__); \
         }
 
@@ -58,5 +59,5 @@
             NetworkFunctionPointer p1; \
             copyPtr( &class::function, p1 ); \
-            FunctionCallManager::addCallMember(NetworkMemberFunctionBase::getFunction(p1)->getNetworkID(), objectID, __VA_ARGS__); \
+            FunctionCallManager::addCallMember(NetworkFunctionManager::getFunction(p1)->getNetworkID(), objectID, __VA_ARGS__); \
         }
 
Index: /code/branches/core7/src/libraries/network/NetworkFunctionManager.cc
===================================================================
--- /code/branches/core7/src/libraries/network/NetworkFunctionManager.cc	(revision 10470)
+++ /code/branches/core7/src/libraries/network/NetworkFunctionManager.cc	(revision 10471)
@@ -32,4 +32,7 @@
 namespace orxonox
 {
+    std::map<NetworkFunctionPointer, NetworkFunctionBase*> NetworkFunctionManager::functorMap_;
+    std::map<uint32_t, NetworkFunctionBase*> NetworkFunctionManager::idMap_;
+
     /* static */NetworkFunctionManager& NetworkFunctionManager::getInstance()
     {
@@ -58,3 +61,17 @@
         return nameMap_;
     }
+
+    /*static*/NetworkFunctionBase* NetworkFunctionManager::getFunction(const NetworkFunctionPointer& p)
+    {
+        std::map<NetworkFunctionPointer, NetworkFunctionBase*>::iterator it = functorMap_.find(p);
+        assert(it != functorMap_.end());
+        return it->second;
+    }
+
+    /*static*/NetworkFunctionBase* NetworkFunctionManager::getFunction(uint32_t id)
+    {
+        std::map<uint32_t, NetworkFunctionBase*>::iterator it = idMap_.find(id);
+        assert(it != idMap_.end());
+        return it->second;
+    }
 }
Index: /code/branches/core7/src/libraries/network/NetworkFunctionManager.h
===================================================================
--- /code/branches/core7/src/libraries/network/NetworkFunctionManager.h	(revision 10470)
+++ /code/branches/core7/src/libraries/network/NetworkFunctionManager.h	(revision 10471)
@@ -45,4 +45,16 @@
             static void destroyAllNetworkFunctions();
             static std::map<std::string, NetworkFunctionBase*>& getNameMap();
+
+            static inline std::map<NetworkFunctionPointer, NetworkFunctionBase*>& getFunctorMap()
+                { return functorMap_; }
+            static inline std::map<uint32_t, NetworkFunctionBase*>& getIdMap()
+                { return idMap_; }
+
+            static NetworkFunctionBase* getFunction(const NetworkFunctionPointer& p);
+            static NetworkFunctionBase* getFunction(uint32_t id);
+
+        private:
+            static std::map<NetworkFunctionPointer, NetworkFunctionBase*> functorMap_;
+            static std::map<uint32_t, NetworkFunctionBase*> idMap_;
     };
 }
