Index: code/trunk/src/libraries/network/Client.cc
===================================================================
--- code/trunk/src/libraries/network/Client.cc	(revision 6105)
+++ code/trunk/src/libraries/network/Client.cc	(revision 6417)
@@ -62,5 +62,6 @@
   Client::Client():
       isSynched_(false),
-      gameStateFailure_(false)
+      gameStateFailure_(false),
+      timeSinceLastUpdate_(0)
   {
   }
@@ -73,5 +74,6 @@
   Client::Client(const std::string& address, int port):
       isSynched_(false),
-      gameStateFailure_(false)
+      gameStateFailure_(false),
+      timeSinceLastUpdate_(0)
   {
       setPort( port );
@@ -111,5 +113,5 @@
     return true;
   }
-  
+
   void Client::printRTT(){
     COUT(0) << "Round trip time to server is " << ClientConnection::getRTT() << " ms" << endl;
@@ -137,5 +139,5 @@
     {
       timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
-      //     COUT(3) << ".";
+      //     COUT(3) << '.';
       if ( isConnected() && isSynched_ )
       {
@@ -153,5 +155,5 @@
     }
     sendPackets(); // flush the enet queue
-    
+
     Connection::processQueue();
     if(gamestate.processGamestates())
@@ -165,5 +167,5 @@
     return;
   }
-  
+
   void Client::connectionClosed()
   {
Index: code/trunk/src/libraries/network/ClientConnection.cc
===================================================================
--- code/trunk/src/libraries/network/ClientConnection.cc	(revision 6105)
+++ code/trunk/src/libraries/network/ClientConnection.cc	(revision 6417)
@@ -69,5 +69,5 @@
   {
     ENetEvent event;
-    
+
     this->host_ = enet_host_create(NULL, NETWORK_CLIENT_MAX_CONNECTIONS, 0, 0);
     if ( this->host_ == NULL )
@@ -99,5 +99,5 @@
   bool ClientConnection::closeConnection() {
     ENetEvent event;
-    
+
     if ( !this->established_ )
       return true;
@@ -146,7 +146,7 @@
     this->connectionClosed();
   }
-  
+
   uint32_t ClientConnection::getRTT()
-  { 
+  {
     assert(server_);
     return server_->roundTripTime;
Index: code/trunk/src/libraries/network/ClientConnection.h
===================================================================
--- code/trunk/src/libraries/network/ClientConnection.h	(revision 6105)
+++ code/trunk/src/libraries/network/ClientConnection.h	(revision 6417)
@@ -26,5 +26,5 @@
  *
  */
- 
+
 #ifndef _ClientConnection_H__
 #define _ClientConnection_H__
@@ -40,8 +40,8 @@
     ClientConnection();
     virtual ~ClientConnection();
-    
+
     void setServerAddress( const std::string& serverAddress );
     void setPort( unsigned int port );
-    
+
     ENetEvent *getEvent();
     // check wheter the packet queue is empty
@@ -59,5 +59,5 @@
     virtual void addPeer(ENetEvent* event);
     virtual void removePeer(ENetEvent* event);
-    
+
     bool disconnectConnection();
     // enet stuff
Index: code/trunk/src/libraries/network/ClientConnectionListener.cc
===================================================================
--- code/trunk/src/libraries/network/ClientConnectionListener.cc	(revision 6105)
+++ code/trunk/src/libraries/network/ClientConnectionListener.cc	(revision 6417)
@@ -36,6 +36,6 @@
 {
     ClientConnectionListener::ClientConnectionListener()
-    { 
-        RegisterRootObject(ClientConnectionListener); 
+    {
+        RegisterRootObject(ClientConnectionListener);
     }
 
@@ -45,5 +45,5 @@
             it->clientConnected(clientID);
     }
-    
+
     void ClientConnectionListener::broadcastClientDisconnected(unsigned int clientID)
     {
Index: code/trunk/src/libraries/network/ClientConnectionListener.h
===================================================================
--- code/trunk/src/libraries/network/ClientConnectionListener.h	(revision 6105)
+++ code/trunk/src/libraries/network/ClientConnectionListener.h	(revision 6417)
@@ -40,5 +40,5 @@
             ClientConnectionListener();
             virtual ~ClientConnectionListener() {}
-            
+
             static void broadcastClientConnected(unsigned int clientID);
             static void broadcastClientDisconnected(unsigned int clientID);
Index: code/trunk/src/libraries/network/ClientInformation.cc
===================================================================
--- code/trunk/src/libraries/network/ClientInformation.cc	(revision 6105)
+++ code/trunk/src/libraries/network/ClientInformation.cc	(revision 6417)
@@ -46,5 +46,5 @@
 namespace orxonox
 {
-  
+
 
   ClientInformation *ClientInformation::head_=0;
Index: code/trunk/src/libraries/network/Connection.cc
===================================================================
--- code/trunk/src/libraries/network/Connection.cc	(revision 6105)
+++ code/trunk/src/libraries/network/Connection.cc	(revision 6417)
@@ -75,5 +75,5 @@
   void Connection::processQueue() {
     ENetEvent event;
-    
+
     assert(this->host_);
 
Index: code/trunk/src/libraries/network/Connection.h
===================================================================
--- code/trunk/src/libraries/network/Connection.h	(revision 6105)
+++ code/trunk/src/libraries/network/Connection.h	(revision 6417)
@@ -54,5 +54,5 @@
   public:
     virtual ~Connection();
-    
+
     static bool addPacket(ENetPacket *packet, ENetPeer *peer);
     bool sendPackets();
@@ -62,13 +62,13 @@
     Connection();
     static Connection* getInstance(){ return Connection::instance_; }
-    
+
     int service(ENetEvent* event);
     virtual void disconnectPeer(ENetPeer *peer);
-    
+
     void processQueue();
     virtual void addPeer(ENetEvent* event)=0;
     virtual void removePeer(ENetEvent* event)=0;
     virtual bool processPacket(ENetEvent* event);
-    
+
     ENetHost *host_;
   private:
Index: code/trunk/src/libraries/network/FunctionCallManager.cc
===================================================================
--- code/trunk/src/libraries/network/FunctionCallManager.cc	(revision 6105)
+++ code/trunk/src/libraries/network/FunctionCallManager.cc	(revision 6417)
@@ -31,5 +31,5 @@
 
 namespace orxonox {
-    
+
 std::map<uint32_t, packet::FunctionCalls*> FunctionCallManager::clientMap_;
 
@@ -37,55 +37,55 @@
 
 void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID)
-{  
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager::clientMap_[clientID]->addCallStatic(functionID);
 }
 void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1)
-{  
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1);
 }
 void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2)
-{  
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1, &mt2);
 }
 void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3)
-{  
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1, &mt2, &mt3);
 }
 void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)
-{  
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1, &mt2, &mt3, &mt4);
 }
 void FunctionCallManager::addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)
-{  
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager:: clientMap_[clientID]->addCallStatic(functionID, &mt1, &mt2, &mt3, &mt4, &mt5);
 }
@@ -95,55 +95,55 @@
 
 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID)
-{ 
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID);
 }
 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1)
-{ 
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1);
 }
 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2)
-{ 
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1, &mt2);
 }
 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3)
-{ 
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1, &mt2, &mt3);
 }
 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)
-{ 
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1, &mt2, &mt3, &mt4);
 }
 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)
-{ 
-  if(clientMap_.find(clientID)==clientMap_.end()) 
+{
+  if(clientMap_.find(clientID)==clientMap_.end())
   {
-    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls; 
-    FunctionCallManager::clientMap_[clientID]->setClientID(clientID); 
-  } 
+    FunctionCallManager::clientMap_[clientID] = new packet::FunctionCalls;
+    FunctionCallManager::clientMap_[clientID]->setClientID(clientID);
+  }
   FunctionCallManager::clientMap_[clientID]->addCallMember(functionID, objectID, &mt1, &mt2, &mt3, &mt4, &mt5);
 }
Index: code/trunk/src/libraries/network/FunctionCallManager.h
===================================================================
--- code/trunk/src/libraries/network/FunctionCallManager.h	(revision 6105)
+++ code/trunk/src/libraries/network/FunctionCallManager.h	(revision 6417)
@@ -49,5 +49,5 @@
   static void addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4);
   static void addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5);
-  
+
   static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID);
   static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1);
@@ -56,7 +56,7 @@
   static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4);
   static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5);
-  
+
   static void sendCalls();
-  
+
   static std::map<uint32_t, packet::FunctionCalls*> clientMap_;
 protected:
Index: code/trunk/src/libraries/network/GamestateClient.cc
===================================================================
--- code/trunk/src/libraries/network/GamestateClient.cc	(revision 6105)
+++ code/trunk/src/libraries/network/GamestateClient.cc	(revision 6417)
@@ -54,5 +54,5 @@
       std::map<unsigned int, packet::Gamestate *>::iterator it;
       for ( it = this->gamestateMap_.begin(); it != this->gamestateMap_.end(); ++it )
-          delete (*it).second;
+          delete it->second;
       if( this->tempGamestate_ )
           delete this->tempGamestate_;
@@ -81,8 +81,8 @@
     packet::Gamestate *processed = processGamestate(tempGamestate_);
     assert(processed);
-    
+
     //now call the queued callbacks
     NetworkCallbackManager::callCallbacks();
-    
+
     if (!processed){
       sendAck(0);
@@ -126,5 +126,5 @@
         break;
       // otherwise delete that stuff
-      delete (*it).second;
+      delete it->second;
       temp=it++;
       gamestateMap_.erase(temp);
@@ -137,5 +137,5 @@
     COUT(4) << "gamestates: ";
     for(it=gamestateMap_.begin(); it!=gamestateMap_.end(); it++){
-      COUT(4) << it->first << ":" << it->second << "|";
+      COUT(4) << it->first << ':' << it->second << '|';
     }
     COUT(4) << std::endl;
Index: code/trunk/src/libraries/network/GamestateHandler.cc
===================================================================
--- code/trunk/src/libraries/network/GamestateHandler.cc	(revision 6105)
+++ code/trunk/src/libraries/network/GamestateHandler.cc	(revision 6417)
@@ -33,5 +33,5 @@
 
 GamestateHandler *GamestateHandler::instance_=0;
-  
+
 GamestateHandler::GamestateHandler()
 {
Index: code/trunk/src/libraries/network/GamestateManager.cc
===================================================================
--- code/trunk/src/libraries/network/GamestateManager.cc	(revision 6105)
+++ code/trunk/src/libraries/network/GamestateManager.cc	(revision 6417)
@@ -69,5 +69,5 @@
         delete this->reference;std::map<unsigned int, packet::Gamestate*>::iterator it;
     for( it = gamestateQueue.begin(); it != gamestateQueue.end(); ++it )
-      delete (*it).second;
+      delete it->second;
     std::map<unsigned int, std::map<unsigned int, packet::Gamestate*> >::iterator it1;
     std::map<unsigned int, packet::Gamestate*>::iterator it2;
@@ -75,5 +75,5 @@
     {
       for( it2 = it1->second.begin(); it2 != it1->second.end(); ++it2 )
-        delete (*it2).second;
+        delete it2->second;
     }
     this->trafficControl_->destroy();
@@ -126,5 +126,5 @@
     return true;
   }
-  
+
   void GamestateManager::sendGamestates()
   {
@@ -142,9 +142,9 @@
       COUT(5) << "Server: doing gamestate gamestate preparation" << std::endl;
       int cid = temp->getID(); //get client id
-      
+
       unsigned int gID = temp->getGamestateID();
       if(!reference)
         return;
-      
+
       packet::Gamestate *client=0;
       if(gID != GAMESTATEID_INITIAL){
@@ -156,8 +156,8 @@
         }
       }
-      
+
       clientGamestates.push(0);
       finishGamestate( cid, &clientGamestates.back(), client, reference );
-      //FunctorMember<GamestateManager>* functor = 
+      //FunctorMember<GamestateManager>* functor =
 //       ExecutorMember<GamestateManager>* executor = createExecutor( createFunctor(&GamestateManager::finishGamestate, this) );
 //       executor->setDefaultValues( cid, &clientGamestates.back(), client, reference );
@@ -165,10 +165,10 @@
 //       this->threadPool_->passFunction( executor, true );
 //       (*functor)( cid, &(clientGamestates.back()), client, reference );
-      
+
       temp = temp->next();
     }
-    
+
 //     threadPool_->synchronise();
-    
+
     while( !clientGamestates.empty() )
     {
@@ -185,5 +185,5 @@
     // save the (undiffed) gamestate in the clients gamestate map
     //chose wheather the next gamestate is the first or not
-    
+
     packet::Gamestate *gs = gamestate->doSelection(clientID, 20000);
 //     packet::Gamestate *gs = new packet::Gamestate(*gamestate);
@@ -193,8 +193,8 @@
     gamestateMap_[clientID][gamestate->getID()]=gs;
 //     this->threadMutex_->unlock();
-    
+
     if(base)
     {
-        
+
 //       COUT(3) << "diffing" << std::endl;
 //       packet::Gamestate* gs1  = gs;
@@ -210,6 +210,6 @@
       gs = new packet::Gamestate(*gs);
     }
-    
-    
+
+
     bool b = gs->compressData();
     assert(b);
Index: code/trunk/src/libraries/network/NetworkFunction.cc
===================================================================
--- code/trunk/src/libraries/network/NetworkFunction.cc	(revision 6105)
+++ code/trunk/src/libraries/network/NetworkFunction.cc	(revision 6417)
@@ -32,10 +32,6 @@
 namespace orxonox
 {
-  std::map<std::string, NetworkFunctionBase*> NetworkFunctionBase::nameMap_;
   std::map<uint32_t, bool> NetworkFunctionBase::isStaticMap_;
-  
-  std::map<NetworkFunctionPointer, NetworkFunctionStatic*> NetworkFunctionStatic::functorMap_;
-  std::map<uint32_t, NetworkFunctionStatic*> NetworkFunctionStatic::idMap_;
-      
+
   std::map<NetworkFunctionPointer, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::functorMap_;
   std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_;
@@ -44,54 +40,73 @@
   {
     RegisterRootObject(NetworkFunctionBase);
-    
+
     static uint32_t networkID = 0;
     this->networkID_ = networkID++;
-    
+
     this->name_ = name;
-    nameMap_[name] = this;
+    NetworkFunctionBase::getNameMap()[name] = this;
   }
   NetworkFunctionBase::~NetworkFunctionBase()
   {
   }
-  
-  
+
+
   void NetworkFunctionBase::destroyAllNetworkFunctions()
   {
+    std::map<std::string, NetworkFunctionBase*>& map = NetworkFunctionBase::getNameMap();
     std::map<std::string, NetworkFunctionBase*>::iterator it;
-    for( it=NetworkFunctionBase::nameMap_.begin(); it!=NetworkFunctionBase::nameMap_.end(); ++it )
+    for( it=map.begin(); it!=map.end(); ++it )
       it->second->destroy();
   }
-  
-  
+
+
+  /*static*/ std::map<std::string, NetworkFunctionBase*>& NetworkFunctionBase::getNameMap()
+  {
+    static std::map<std::string, NetworkFunctionBase*> nameMap_;
+    return nameMap_;
+  }
+
+
   NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p):
     NetworkFunctionBase(name)
   {
     RegisterObject(NetworkFunctionStatic);
-    
+
     this->functor_ = functor;
-    functorMap_[p] = this;
-    idMap_[ this->getNetworkID() ] = this;
+    NetworkFunctionStatic::getFunctorMap()[p] = this;
+    NetworkFunctionStatic::getIdMap()[ this->getNetworkID() ] = this;
   }
-  
+
   NetworkFunctionStatic::~NetworkFunctionStatic()
   {
     delete this->functor_;
   }
-  
-  
-  
+
+  /*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)
   {
     RegisterObject(NetworkMemberFunctionBase);
-    
-    functorMap_[p] = this;
-    idMap_[ this->getNetworkID() ] = this;
+
+    this->functorMap_[p] = this;
+    this->idMap_[ this->getNetworkID() ] = this;
   }
-  
+
   NetworkMemberFunctionBase::~NetworkMemberFunctionBase()
   {
   }
-  
+
 
 }
Index: code/trunk/src/libraries/network/NetworkFunction.h
===================================================================
--- code/trunk/src/libraries/network/NetworkFunction.h	(revision 6105)
+++ code/trunk/src/libraries/network/NetworkFunction.h	(revision 6417)
@@ -74,22 +74,27 @@
     NetworkFunctionBase(const std::string& name);
     ~NetworkFunctionBase();
-    
+
     virtual void        setNetworkID(uint32_t id)       { this->networkID_ = id; }
     inline uint32_t     getNetworkID() const            { return this->networkID_; }
     inline const std::string& getName() const           { return name_; }
     static inline bool  isStatic( uint32_t networkID )  { return isStaticMap_[networkID]; }
-    
-    static inline void setNetworkID(const std::string& name, uint32_t id){ assert( nameMap_.find(name)!=nameMap_.end() ); nameMap_[name]->setNetworkID(id); }
-    
+
+    static inline void setNetworkID(const std::string& name, uint32_t id)
+    {
+        std::map<std::string, NetworkFunctionBase*>& map = NetworkFunctionBase::getNameMap();
+        assert( map.find(name)!=map.end() );
+        map[name]->setNetworkID(id);
+    }
+
     static void destroyAllNetworkFunctions();
-    
+
   protected:
     static std::map<uint32_t, bool> isStaticMap_;
-    
-  private:
-    static std::map<std::string, NetworkFunctionBase*> nameMap_;
+
+  private:
+    static std::map<std::string, NetworkFunctionBase*>& getNameMap();
     uint32_t networkID_;
     std::string name_;
-      
+
 };
 
@@ -99,5 +104,5 @@
     NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p);
     ~NetworkFunctionStatic();
-    
+
     inline void call(){ (*this->functor_)(); }
     inline void call(const MultiType& mt1){ (*this->functor_)(mt1); }
@@ -106,16 +111,19 @@
     inline void call(const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4){ (*this->functor_)(mt1, mt2, mt3, mt4); }
     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 ); idMap_[id] = this; }
-    static inline NetworkFunctionStatic* getNetworkFunction( uint32_t id){ assert( idMap_.find(id)!=idMap_.end() ); return idMap_[id]; }
-    static NetworkFunctionStatic* getFunction( uint32_t id ){ assert( idMap_.find(id) != idMap_.end() ); return idMap_[id]; }
-    static NetworkFunctionStatic* getFunction( const NetworkFunctionPointer& p ){ assert( functorMap_.find(p) != functorMap_.end() ); return functorMap_[p]; }
-    
-  private:
-    static std::map<NetworkFunctionPointer, NetworkFunctionStatic*> functorMap_;
-    static std::map<uint32_t, NetworkFunctionStatic*> idMap_;
-    
+
+    virtual void setNetworkID( uint32_t id )
+        { NetworkFunctionBase::setNetworkID( id ); NetworkFunctionStatic::getIdMap()[id] = this; }
+    static inline NetworkFunctionStatic* getNetworkFunction( uint32_t id)
+        { assert( NetworkFunctionStatic::getIdMap().find(id)!=NetworkFunctionStatic::getIdMap().end() ); return NetworkFunctionStatic::getIdMap()[id]; }
+    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();
     FunctorStatic* functor_;
-    
+
 };
 
@@ -125,11 +133,11 @@
     NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p);
     ~NetworkMemberFunctionBase();
-    
+
     virtual void setNetworkID( uint32_t id ){ NetworkFunctionBase::setNetworkID( id ); idMap_[id] = this; }
     static inline NetworkMemberFunctionBase* getNetworkFunction( uint32_t id){ assert( idMap_.find(id)!=idMap_.end() ); return idMap_[id]; }
     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]; }
-    
-    // 
+
+    //
     virtual void call(uint32_t objectID)=0;
     virtual void call(uint32_t objectID, const MultiType& mt1)=0;
@@ -138,5 +146,5 @@
     virtual void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)=0;
     virtual void 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_;
@@ -149,36 +157,36 @@
     NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p);
     ~NetworkMemberFunction();
-    
+
     inline void call(uint32_t objectID)
-    { 
+    {
       if ( Synchronisable::getSynchronisable(objectID)!=0 )
         (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)));
     }
     inline void call(uint32_t objectID, const MultiType& mt1)
-    { 
+    {
       if ( Synchronisable::getSynchronisable(objectID)!=0 )
         (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1);
     }
     inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2)
-    { 
+    {
       if ( Synchronisable::getSynchronisable(objectID)!=0 )
         (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2);
     }
     inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3)
-    { 
+    {
       if ( Synchronisable::getSynchronisable(objectID)!=0 )
         (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3);
     }
     inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)
-    { 
+    {
       if ( Synchronisable::getSynchronisable(objectID)!=0 )
         (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4);
     }
     inline void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)
-    { 
+    {
       if ( Synchronisable::getSynchronisable(objectID)!=0 )
         (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4, mt5);
     }
-    
+
   private:
     FunctorMember<T>* functor_;
Index: code/trunk/src/libraries/network/NetworkPrereqs.h
===================================================================
--- code/trunk/src/libraries/network/NetworkPrereqs.h	(revision 6105)
+++ code/trunk/src/libraries/network/NetworkPrereqs.h	(revision 6417)
@@ -144,4 +144,6 @@
   template <class T>
   class NetworkCallback;
+  template <class T, class U>
+  class NetworkCallbackNotify;
   class NetworkCallbackBase;
   class NetworkCallbackManager;
Index: code/trunk/src/libraries/network/Server.cc
===================================================================
--- code/trunk/src/libraries/network/Server.cc	(revision 6105)
+++ code/trunk/src/libraries/network/Server.cc	(revision 6417)
@@ -137,13 +137,13 @@
     // receive incoming packets
     Connection::processQueue();
-    
+
     if ( ClientInformation::hasClients() )
     {
       // process incoming gamestates
       GamestateManager::processGamestates();
-      
+
       // send function calls to clients
       FunctionCallManager::sendCalls();
-      
+
       //this steers our network frequency
       timeSinceLastUpdate_+=time.getDeltaTime();
@@ -160,7 +160,7 @@
     return ServerConnection::addPacket(packet, clientID);
   }
-  
-  /**
-   * @brief: returns ping time to client in milliseconds 
+
+  /**
+   * @brief: returns ping time to client in milliseconds
    */
   unsigned int Server::getRTT(unsigned int clientID){
@@ -168,5 +168,5 @@
     return ClientInformation::findClient(clientID)->getRTT();
   }
-  
+
   void Server::printRTT()
   {
@@ -317,8 +317,8 @@
     }
     COUT(5) << "Con.Man: creating client id: " << temp->getID() << std::endl;
-    
+
     // synchronise class ids
     syncClassid(temp->getID());
-    
+
     // now synchronise functionIDs
     packet::FunctionIDs *fIDs = new packet::FunctionIDs();
@@ -326,5 +326,5 @@
     bool b = fIDs->send();
     assert(b);
-    
+
     temp->setSynched(true);
     COUT(4) << "sending welcome" << std::endl;
@@ -344,5 +344,5 @@
     return true;
   }
-  
+
   void Server::disconnectClient( ClientInformation *client ){
     ServerConnection::disconnectClient( client );
Index: code/trunk/src/libraries/network/Server.h
===================================================================
--- code/trunk/src/libraries/network/Server.h	(revision 6105)
+++ code/trunk/src/libraries/network/Server.h	(revision 6417)
@@ -66,8 +66,8 @@
     unsigned int shipID(){return 0;}
     unsigned int playerID(){return 0;}
-    
+
     void addPeer(ENetEvent *event);
     void removePeer(ENetEvent *event);
-    
+
     bool createClient(int clientID);
     void disconnectClient( ClientInformation *client);
Index: code/trunk/src/libraries/network/ServerConnection.cc
===================================================================
--- code/trunk/src/libraries/network/ServerConnection.cc	(revision 6105)
+++ code/trunk/src/libraries/network/ServerConnection.cc	(revision 6417)
@@ -99,10 +99,10 @@
     return true;
   }
-  
+
   void ServerConnection::disconnectClient(ClientInformation *client)
   {
     Connection::disconnectPeer( client->getPeer() );
   }
-  
+
   void ServerConnection::disconnectClient(int clientID){
     ClientInformation *client = ClientInformation::findClient(clientID);
Index: code/trunk/src/libraries/network/ServerConnection.h
===================================================================
--- code/trunk/src/libraries/network/ServerConnection.h	(revision 6105)
+++ code/trunk/src/libraries/network/ServerConnection.h	(revision 6417)
@@ -50,8 +50,8 @@
   public:
     ~ServerConnection();
-    
+
     void setBindAddress( const std::string& bindAddress );
     void setPort( unsigned int port );
-    
+
     bool openListener();
     bool closeListener();
Index: code/trunk/src/libraries/network/TrafficControl.cc
===================================================================
--- code/trunk/src/libraries/network/TrafficControl.cc	(revision 6105)
+++ code/trunk/src/libraries/network/TrafficControl.cc	(revision 6417)
@@ -145,5 +145,5 @@
     assert(clientListPerm_.find(clientID) != clientListPerm_.end() );
     assert( clientListTemp_[clientID].find(gamestateID) != clientListTemp_[clientID].end() );
-    
+
     // shortcut for maps
     std::map<unsigned int, objInfo >& objectListPerm = clientListPerm_[clientID];
@@ -152,16 +152,16 @@
     for(itvec = objectListTemp[gamestateID].begin(); itvec != objectListTemp[gamestateID].end(); itvec++)
       {
-      if(objectListPerm.find((*itvec).objID) != objectListPerm.end()) // check whether the obj already exists in our lists
-      {
-        objectListPerm[(*itvec).objID].objCurGS = gamestateID;
-        objectListPerm[(*itvec).objID].objValueSched = 0; //set scheduling value back
+      if(objectListPerm.find(itvec->objID) != objectListPerm.end()) // check whether the obj already exists in our lists
+      {
+        objectListPerm[itvec->objID].objCurGS = gamestateID;
+        objectListPerm[itvec->objID].objValueSched = 0; //set scheduling value back
       }
       else
       {
         assert(0);
-        objectListPerm[(*itvec).objID].objCurGS = gamestateID;
-        objectListPerm[(*itvec).objID].objID = (*itvec).objID;
-        objectListPerm[(*itvec).objID].objCreatorID = (*itvec).objCreatorID;
-        objectListPerm[(*itvec).objID].objSize = (*itvec).objSize;
+        objectListPerm[itvec->objID].objCurGS = gamestateID;
+        objectListPerm[itvec->objID].objID = itvec->objID;
+        objectListPerm[itvec->objID].objCreatorID = itvec->objCreatorID;
+        objectListPerm[itvec->objID].objSize = itvec->objSize;
       }
       }
@@ -205,13 +205,13 @@
     for(itvec = list.begin(); itvec != list.end();)
     {
-      assert( (*itvec).objSize < 1000);
-      if ( ( size + (*itvec).objSize ) < targetsize )
-      {
-        size += (*itvec).objSize;//objSize is given in bytes
+      assert( itvec->objSize < 1000);
+      if ( ( size + itvec->objSize ) < targetsize )
+      {
+        size += itvec->objSize;//objSize is given in bytes
         ++itvec;
       }
       else
       {
-        clientListPerm_[currentClientID][(*itvec).objID].objValueSched += SCHED_PRIORITY_OFFSET; // NOTE: SCHED_PRIORITY_OFFSET is negative
+        clientListPerm_[currentClientID][itvec->objID].objValueSched += SCHED_PRIORITY_OFFSET; // NOTE: SCHED_PRIORITY_OFFSET is negative
         list.erase(itvec, list.end());
         break;
@@ -236,14 +236,14 @@
       //if listToProcess contains new Objects, add them to clientListPerm
       std::list<obj>::iterator itvec;
-    
+
       std::map<unsigned int, objInfo >& objectListPerm = clientListPerm_[clientID];
-    
+
       for( itvec=list.begin(); itvec != list.end(); itvec++)
       {
-        if ( objectListPerm.find( (*itvec).objID) != objectListPerm.end() )
+        if ( objectListPerm.find( itvec->objID) != objectListPerm.end() )
         {
         // we already have the object in our map
         //obj bleibt in liste und permanente prio wird berechnet
-          objectListPerm[(*itvec).objID].objDiffGS = currentGamestateID - objectListPerm[(*itvec).objID].objCurGS;
+          objectListPerm[itvec->objID].objDiffGS = currentGamestateID - objectListPerm[itvec->objID].objCurGS;
           continue;//check next objId
         }
@@ -256,10 +256,10 @@
       }
     //end compare listToProcess vs clientListPerm
-      
+
       //sort copied list according to priorities
       // use boost bind here because we need to pass a memberfunction to stl sort
 //       sort( list.begin(), list.end(), boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) );
       list.sort( boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) );
-      
+
 //       list.sort(boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) );
 
@@ -277,5 +277,5 @@
 //       sort(list.begin(), list.end(), boost::bind(&TrafficControl::dataSort, this, _1, _2) );
       list.sort( boost::bind(&TrafficControl::dataSort, this, _1, _2) );
-      
+
       //diese Funktion updateClientList muss noch gemacht werden
       updateClientListTemp(list);
@@ -289,17 +289,17 @@
     COUT(0) << "=========== Objectlist ===========" << endl;
     for( it=list.begin(); it!=list.end(); it++)
-      COUT(0) << "ObjectID: " << (*it).objID << " creatorID: " << (*it).objCreatorID << " Priority: " << clientListPerm_[clientID][(*it).objID].objValuePerm + clientListPerm_[clientID][(*it).objID].objValueSched << " size: " << (*it).objSize << endl;
+      COUT(0) << "ObjectID: " << it->objID << " creatorID: " << it->objCreatorID << " Priority: " << clientListPerm_[clientID][it->objID].objValuePerm + clientListPerm_[clientID][it->objID].objValueSched << " size: " << it->objSize << endl;
   }
 
   void TrafficControl::fixCreatorDependencies(std::list<obj>::iterator it1, std::list<obj>& list, unsigned int clientID)
   {
-    if ( (*it1).objCreatorID == OBJECTID_UNKNOWN )
-      return;
-    if( clientListPerm_[clientID][(*it1).objCreatorID].objCurGS != GAMESTATEID_INITIAL )
+    if ( it1->objCreatorID == OBJECTID_UNKNOWN )
+      return;
+    if( clientListPerm_[clientID][it1->objCreatorID].objCurGS != GAMESTATEID_INITIAL )
       return;
     std::list<obj>::iterator it2, it3=it1;
     for( it2 = ++it3; it2 != list.end(); it2++ )
     {
-      if( (*it2).objID == (*it1).objCreatorID )
+      if( it2->objID == it1->objCreatorID )
       {
         it3 = list.insert(it1, *it2); //insert creator before it1
Index: code/trunk/src/libraries/network/TrafficControl.h
===================================================================
--- code/trunk/src/libraries/network/TrafficControl.h	(revision 6105)
+++ code/trunk/src/libraries/network/TrafficControl.h	(revision 6417)
@@ -69,5 +69,5 @@
       obj( uint32_t ID, uint32_t creatorID, uint32_t size, uint32_t offset );
   };
-  
+
 
 
@@ -97,7 +97,7 @@
     unsigned int targetSize;
     bool         bActive_;
-    
+
     void insertinClientListPerm(unsigned int clientID, obj objinf);
-    
+
     void cut(std::list<obj>& list, unsigned int targetsize);
     void updateClientListTemp(std::list<obj>& list);//done
@@ -105,12 +105,12 @@
     *evaluates Data given (list) and produces result(->Data to be updated)
     */
-    void evaluateList(unsigned int clientID, std::list<obj>& list);//done    
+    void evaluateList(unsigned int clientID, std::list<obj>& list);//done
     void ack(unsigned int clientID, unsigned int gamestateID);  // this function gets called when the server receives an ack from the client
-    
+
     //ClientConnectionListener functions
     virtual void clientConnected(unsigned int clientID){};
     virtual void clientDisconnected(unsigned int clientID);
 
- 
+
   protected:
     static TrafficControl *instance_;
@@ -121,5 +121,5 @@
     /**
     *is being used by GSManager from Server:
-    *list contains: ObjIds, CreatorIds, Size (in this order) from Client XY 
+    *list contains: ObjIds, CreatorIds, Size (in this order) from Client XY
     *Elements of list are accessed by *list[i]
     *Elements of struct i are therefore: *list[i].objID
@@ -131,5 +131,5 @@
     { return instance_->ack(clientID, gamestateID); }
     void deleteObject(unsigned int objectID);               // this function gets called when an object has been deleted (in order to clean up lists and maps)
-    
+
     bool prioritySort(uint32_t clientID, obj i, obj j);
     bool dataSort(obj i, obj j);
Index: code/trunk/src/libraries/network/packet/Acknowledgement.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Acknowledgement.cc	(revision 6105)
+++ code/trunk/src/libraries/network/packet/Acknowledgement.cc	(revision 6417)
@@ -38,5 +38,5 @@
 #define _PACKETID           0
 #define _ACKID              _PACKETID + sizeof(packet::Type::Value)
-  
+
 Acknowledgement::Acknowledgement( unsigned int id, unsigned int clientID )
  : Packet()
Index: code/trunk/src/libraries/network/packet/Chat.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Chat.cc	(revision 6105)
+++ code/trunk/src/libraries/network/packet/Chat.cc	(revision 6417)
@@ -35,5 +35,5 @@
 namespace orxonox {
 namespace packet {
-  
+
 #define   PACKET_FLAGS_CHAT PacketFlag::Reliable
 #define   _PACKETID         0
Index: code/trunk/src/libraries/network/packet/ClassID.cc
===================================================================
--- code/trunk/src/libraries/network/packet/ClassID.cc	(revision 6105)
+++ code/trunk/src/libraries/network/packet/ClassID.cc	(revision 6417)
@@ -48,5 +48,4 @@
 ClassID::ClassID( ) : Packet(){
   Identifier *id;
-  std::string classname;
   unsigned int nrOfClasses=0;
   unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nrofclasses
@@ -58,8 +57,8 @@
   std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapBegin();
   for(;it != Identifier::getStringIdentifierMapEnd();++it){
-    id = (*it).second;
+    id = it->second;
     if(id == NULL || !id->hasFactory())
       continue;
-    classname = id->getName();
+    const std::string& classname = id->getName();
     network_id = id->getNetworkID();
     // now push the network id and the classname to the stack
Index: code/trunk/src/libraries/network/packet/ClassID.h
===================================================================
--- code/trunk/src/libraries/network/packet/ClassID.h	(revision 6105)
+++ code/trunk/src/libraries/network/packet/ClassID.h	(revision 6417)
@@ -36,5 +36,5 @@
 namespace packet {
 
-  
+
 /**
     @author
Index: code/trunk/src/libraries/network/packet/DeleteObjects.cc
===================================================================
--- code/trunk/src/libraries/network/packet/DeleteObjects.cc	(revision 6105)
+++ code/trunk/src/libraries/network/packet/DeleteObjects.cc	(revision 6417)
@@ -41,5 +41,5 @@
 #define _QUANTITY           _PACKETID + sizeof(Type::Value)
 #define _OBJECTIDS          _QUANTITY + sizeof(uint32_t)
-  
+
 DeleteObjects::DeleteObjects()
  : Packet()
@@ -71,7 +71,6 @@
   for(unsigned int i=0; i<number; i++){
     unsigned int temp = Synchronisable::popDeletedObject();
-//     assert(temp<10000); //ugly hack
     *reinterpret_cast<uint32_t*>(tdata) = temp;
-    COUT(4) << temp << " ";
+    COUT(4) << temp << ' ';
     tdata += sizeof(uint32_t);
   }
Index: code/trunk/src/libraries/network/packet/FunctionCalls.cc
===================================================================
--- code/trunk/src/libraries/network/packet/FunctionCalls.cc	(revision 6105)
+++ code/trunk/src/libraries/network/packet/FunctionCalls.cc	(revision 6417)
@@ -36,9 +36,9 @@
 namespace orxonox {
 namespace packet {
-  
+
 #define   PACKET_FLAGS_FUNCTIONCALLS PacketFlag::Reliable
 #define   _PACKETID         0
 const unsigned int FUNCTIONCALLS_MEM_ALLOCATION = 1000;
-    
+
 FunctionCalls::FunctionCalls()
  : Packet()
@@ -171,5 +171,5 @@
 void FunctionCalls::addCallStatic( uint32_t networkID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){
   assert(!isDataENetAllocated());
-  
+
   // first determine the size that has to be reserved for this call
   uint32_t callsize = 2*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and for bool isStatic
@@ -200,5 +200,5 @@
     }
   }
-  
+
   // now allocated mem if neccessary
   if( currentSize_ + callsize > currentMemBlocks_*FUNCTIONCALLS_MEM_ALLOCATION )
@@ -210,5 +210,5 @@
     data_ = temp;
   }
-  
+
   // now serialise the mt values and copy the function id and isStatic
   uint8_t* temp = data_+currentSize_;
@@ -240,10 +240,10 @@
   //currentSize_ += callsize;
   currentSize_ = temp-data_;
-  
+
 }
 
 void FunctionCalls::addCallMember( uint32_t networkID, uint32_t objectID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){
   assert(!isDataENetAllocated());
-  
+
   // first determine the size that has to be reserved for this call
   uint32_t callsize = 3*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and the objectID
@@ -274,5 +274,5 @@
     }
   }
-  
+
   // now allocated mem if neccessary
   if( currentSize_ + callsize > currentMemBlocks_*FUNCTIONCALLS_MEM_ALLOCATION )
@@ -284,5 +284,5 @@
     data_ = temp;
   }
-  
+
   // now serialise the mt values and copy the function id
   uint8_t* temp = data_+currentSize_;
@@ -314,5 +314,5 @@
   }
   currentSize_ += callsize;
-  
+
 }
 
Index: code/trunk/src/libraries/network/packet/FunctionIDs.cc
===================================================================
--- code/trunk/src/libraries/network/packet/FunctionIDs.cc	(revision 6105)
+++ code/trunk/src/libraries/network/packet/FunctionIDs.cc	(revision 6417)
@@ -47,15 +47,14 @@
 
 FunctionIDs::FunctionIDs( ) : Packet(){
-  std::string functionname;
-  unsigned int nrOfFunctions=0; 
+  unsigned int nrOfFunctions=0;
   unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nroffunctions
   uint32_t networkID;
   flags_ = flags_ | PACKET_FLAGS_FUNCTIONIDS;
   std::queue<std::pair<uint32_t, std::string> > tempQueue;
-  
+
   //calculate total needed size (for all strings and integers)
   ObjectList<NetworkFunctionBase>::iterator it;
   for(it = ObjectList<NetworkFunctionBase>::begin(); it; ++it){
-    functionname = it->getName();
+    const std::string& functionname = it->getName();
     networkID = it->getNetworkID();
     // now push the network id and the classname to the stack
@@ -64,15 +63,15 @@
     packetSize += (functionname.size()+1)+sizeof(uint32_t)+sizeof(uint32_t); // reserver size for the functionname string, the functionname length and the networkID
   }
-  
+
   this->data_=new uint8_t[ packetSize ];
   //set the appropriate packet id
   assert(this->data_);
   *(Type::Value *)(this->data_ + _PACKETID ) = Type::FunctionIDs;
-  
+
   uint8_t *temp=data_+sizeof(uint32_t);
   // save the number of all classes
   *(uint32_t*)temp = nrOfFunctions;
   temp += sizeof(uint32_t);
-  
+
   // now save all classids and classnames
   std::pair<uint32_t, std::string> tempPair;
@@ -85,7 +84,7 @@
     temp+=2*sizeof(uint32_t)+tempPair.second.size()+1;
   }
-  
+
   COUT(5) << "FunctionIDs packetSize is " << packetSize << endl;
-  
+
 }
 
@@ -106,5 +105,5 @@
   temp += sizeof(uint32_t);
   totalsize += sizeof(uint32_t); // storage size for nr of all classes
-  
+
   for(unsigned int i=0; i<nrOfFunctions; i++){
     totalsize += 2*sizeof(uint32_t) + *(uint32_t*)(temp + sizeof(uint32_t)); // for each network function add size for id, sizeof(string) and length of string itself to totalsize
@@ -121,5 +120,5 @@
   uint32_t stringsize;
   unsigned char *functionname;
-  
+
   COUT(4) << "=== processing functionids: " << endl;
   std::pair<uint32_t, std::string> tempPair;
@@ -127,5 +126,5 @@
   nrOfFunctions = *(uint32_t*)temp;
   temp += sizeof(uint32_t);
-  
+
   for( int i=0; i<nrOfFunctions; i++){
     networkID = *(uint32_t*)temp;
Index: code/trunk/src/libraries/network/packet/FunctionIDs.h
===================================================================
--- code/trunk/src/libraries/network/packet/FunctionIDs.h	(revision 6105)
+++ code/trunk/src/libraries/network/packet/FunctionIDs.h	(revision 6417)
@@ -36,5 +36,5 @@
 namespace packet {
 
-  
+
 /**
     @author
Index: code/trunk/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Gamestate.cc	(revision 6105)
+++ code/trunk/src/libraries/network/packet/Gamestate.cc	(revision 6417)
@@ -95,5 +95,5 @@
     return false;
   }
-  
+
   // create the header object
   assert( header_ == 0 );
@@ -105,5 +105,5 @@
   ObjectList<Synchronisable>::iterator it;
   for(it = ObjectList<Synchronisable>::begin(); it; ++it){
-    
+
 //     tempsize=it->getSize(id, mode);
 
@@ -111,5 +111,5 @@
     if ( tempsize != 0 )
       dataVector_.push_back( obj(it->getObjectID(), it->getCreatorID(), tempsize, mem-data_) );
-    
+
 #ifndef NDEBUG
     if(currentsize+tempsize > size){
@@ -362,15 +362,15 @@
   assert(!header_->isCompressed() && !base->header_->isCompressed());
   assert(!header_->isDiffed());
-  
+
   uint8_t *basep = GAMESTATE_START(base->data_);
   uint8_t *gs = GAMESTATE_START(this->data_);
   uint32_t dest_length = header_->getDataSize();
-  
+
   if(dest_length==0)
     return NULL;
-  
+
   uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()];
   uint8_t *dest = GAMESTATE_START(ndata);
-  
+
   rawDiff( dest, gs, basep, header_->getDataSize(), base->header_->getDataSize() );
 #ifndef NDEBUG
@@ -398,17 +398,17 @@
   assert(!header_->isCompressed() && !base->header_->isCompressed());
   assert(header_->isDiffed());
-  
+
   uint8_t *basep = GAMESTATE_START(base->data_);
   uint8_t *gs = GAMESTATE_START(this->data_);
   uint32_t dest_length = header_->getDataSize();
-  
+
   if(dest_length==0)
     return NULL;
-  
+
   uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()];
   uint8_t *dest = ndata + GamestateHeader::getSize();
-  
+
   rawDiff( dest, gs, basep, header_->getDataSize(), base->header_->getDataSize() );
-  
+
   Gamestate *g = new Gamestate(ndata, getClientID());
   assert(g->header_);
@@ -437,6 +437,6 @@
 //   uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()];
 //   uint8_t *dest = ndata + GamestateHeader::getSize();
-//   
-//   
+//
+//
 //   // LOOP-UNROLLED DIFFING
 //   uint32_t *dest32 = (uint32_t*)dest, *base32 = (uint32_t*)basep, *gs32 = (uint32_t*)gs;
@@ -465,5 +465,5 @@
 //     }
 //   }
-// 
+//
 //   Gamestate *g = new Gamestate(ndata, getClientID());
 //   *(g->header_) = *header_;
@@ -481,5 +481,5 @@
   uint64_t* bd = (uint64_t*)basedata;
   uint64_t* nd = (uint64_t*)newdata;
-  
+
   unsigned int i;
   for( i=0; i<datalength/8; i++ )
@@ -529,10 +529,10 @@
 //   COUT(0) << "myvector contains:";
 //   for ( itt=dataVector_.begin() ; itt!=dataVector_.end(); itt++ )
-//     COUT(0) << " " << (*itt).objID;
+//     COUT(0) << ' ' << (*itt).objID;
 //   COUT(0) << endl;
   for(it=dataVector_.begin(); it!=dataVector_.end();){
     SynchronisableHeader oldobjectheader(origdata);
     SynchronisableHeader newobjectheader(newdata);
-    if ( (*it).objSize == 0 )
+    if ( it->objSize == 0 )
     {
       ++it;
@@ -541,5 +541,5 @@
     objectsize = oldobjectheader.getDataSize();
     objectOffset=SynchronisableHeader::getSize(); //skip the size and the availableData variables in the objectheader
-    if ( (*it).objID == oldobjectheader.getObjectID() ){
+    if ( it->objID == oldobjectheader.getObjectID() ){
       memcpy(newdata, origdata, objectsize);
       assert(newobjectheader.isDataAvailable()==true);
Index: code/trunk/src/libraries/network/packet/Packet.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Packet.cc	(revision 6105)
+++ code/trunk/src/libraries/network/packet/Packet.cc	(revision 6417)
@@ -101,6 +101,6 @@
 @brief
     Destroys a packet completely.
-    
-    That also means destroying the ENetPacket if one exists. There 
+
+    That also means destroying the ENetPacket if one exists. There
 */
 Packet::~Packet(){
Index: code/trunk/src/libraries/network/synchronisable/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/network/synchronisable/CMakeLists.txt	(revision 6105)
+++ code/trunk/src/libraries/network/synchronisable/CMakeLists.txt	(revision 6417)
@@ -2,5 +2,4 @@
   NetworkCallbackManager.cc
   Synchronisable.cc
-  SynchronisableSpecialisations.cc
   SynchronisableVariable.cc
 )
Index: code/trunk/src/libraries/network/synchronisable/NetworkCallback.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/NetworkCallback.h	(revision 6105)
+++ code/trunk/src/libraries/network/synchronisable/NetworkCallback.h	(revision 6417)
@@ -33,7 +33,10 @@
 #include "network/NetworkPrereqs.h"
 #include "NetworkCallbackManager.h"
+// #include "util/MultiType.h"
 
 namespace orxonox{
-  
+
+  struct EmptyType{};
+
   class _NetworkExport NetworkCallbackBase
   {
@@ -58,4 +61,20 @@
   };
 
+  template <class T, class U>
+  class NetworkCallbackNotify: public NetworkCallbackBase
+  {
+    public:
+      NetworkCallbackNotify(T* object, void (T::*function) (const U&)) : object_(object), function_(function) {}
+      NetworkCallbackNotify() {}
+      virtual ~NetworkCallbackNotify() {}
+      virtual void call()
+        { (this->object_->*function_)( this->oldValue_ ); }
+      void setOldValue(const U& value){ this->oldValue_ = value; }
+    private:
+      T* object_;
+      U oldValue_;
+      void (T::*function_) (const U&);
+  };
+
 }
 
Index: code/trunk/src/libraries/network/synchronisable/NetworkCallbackManager.cc
===================================================================
--- code/trunk/src/libraries/network/synchronisable/NetworkCallbackManager.cc	(revision 6105)
+++ code/trunk/src/libraries/network/synchronisable/NetworkCallbackManager.cc	(revision 6417)
@@ -26,16 +26,16 @@
  *
  */
- 
+
 #include "NetworkCallbackManager.h"
 #include "NetworkCallback.h"
 
 namespace orxonox{
-  
+
   std::set<NetworkCallbackBase*> NetworkCallbackManager::callbackSet_;
   std::queue<NetworkCallbackBase*> NetworkCallbackManager::triggeredCallbacks_;
-  
+
   void NetworkCallbackManager::registerCallback(NetworkCallbackBase *cb)
-  { 
-    callbackSet_.insert(cb); 
+  {
+    callbackSet_.insert(cb);
   }
   void NetworkCallbackManager::deleteCallback(NetworkCallbackBase *cb)
@@ -48,5 +48,5 @@
     }
   }
-  
+
   void NetworkCallbackManager::triggerCallback(NetworkCallbackBase *cb)
   {
Index: code/trunk/src/libraries/network/synchronisable/NetworkCallbackManager.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/NetworkCallbackManager.h	(revision 6105)
+++ code/trunk/src/libraries/network/synchronisable/NetworkCallbackManager.h	(revision 6417)
@@ -37,5 +37,5 @@
 
 namespace orxonox{
-  
+
   class _NetworkExport NetworkCallbackManager{
     public:
@@ -48,5 +48,5 @@
       static std::queue<NetworkCallbackBase*> triggeredCallbacks_;
   };
-  
+
 
 }
Index: code/trunk/src/libraries/network/synchronisable/Serialise.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Serialise.h	(revision 6417)
+++ code/trunk/src/libraries/network/synchronisable/Serialise.h	(revision 6417)
@@ -0,0 +1,79 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Functions to serialise pointers to objects that inherit from Synchronisable
+*/
+
+#ifndef _NetworkSerialise_H__
+#define _NetworkSerialise_H__
+
+#include "util/Serialise.h"
+#include "util/TypeTraits.h"
+#include "core/CorePrereqs.h"
+
+namespace orxonox{
+    
+    // These functions implement loading / saving / etc. for pointer types
+    
+    /** @brief returns the size of the objectID needed to synchronise the pointer */
+    template <class T> inline uint32_t returnSize( T*& variable )
+    {
+      return sizeof(uint32_t);
+    }
+    
+    /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */
+    template <class T> inline void loadAndIncrease( T*& variable, uint8_t*& mem )
+    {
+        *const_cast<typename Loki::TypeTraits<T*>::UnqualifiedType*>(&variable) = dynamic_cast<T*>(variable->getSynchronisable( *(uint32_t*)(mem) ));
+        mem += returnSize( variable );
+    }
+    
+    /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */
+    template <class T> inline void saveAndIncrease( T*& variable, uint8_t*& mem )
+    {
+        if ( variable )
+            *(uint32_t*)(mem) = static_cast<uint32_t>(variable->getObjectID());
+        else
+            *(uint32_t*)(mem) = OBJECTID_UNKNOWN;
+        mem += returnSize( variable );
+    }
+    
+    /** @brief checks whether the objectID of the variable is the same as in the bytestream */
+    template <class T> inline  bool checkEquality( T*& variable, uint8_t* mem )
+    {
+        if ( variable )
+            return *(uint32_t*)(mem) == variable->getObjectID();
+        else
+            return *(uint32_t*)(mem) == OBJECTID_UNKNOWN;
+    }
+}
+
+
+#endif
Index: code/trunk/src/libraries/network/synchronisable/Synchronisable.cc
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Synchronisable.cc	(revision 6105)
+++ code/trunk/src/libraries/network/synchronisable/Synchronisable.cc	(revision 6417)
@@ -62,5 +62,5 @@
     }
     classID_ = static_cast<uint32_t>(-1);
-    
+
     // set dataSize to 0
     this->dataSize_ = 0;
@@ -277,5 +277,5 @@
       //tempsize += (*i)->getSize( mode );
     }
-    
+
     tempsize += SynchronisableHeader::getSize();
     header.setObjectID( this->objectID_ );
@@ -284,5 +284,5 @@
     header.setDataAvailable( true );
     header.setDataSize( tempsize );
-    
+
 #ifndef NDEBUG
     uint32_t size;
@@ -390,4 +390,15 @@
   }
 
+  template <> void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
+  {
+    SynchronisableVariableBase* sv;
+    if (bidirectional)
+      sv = new SynchronisableVariableBidirectional<std::string>(variable, mode, cb);
+    else
+      sv = new SynchronisableVariable<std::string>(variable, mode, cb);
+    syncList.push_back(sv);
+    stringList.push_back(sv);
+  }
+
 
 }
Index: code/trunk/src/libraries/network/synchronisable/Synchronisable.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Synchronisable.h	(revision 6105)
+++ code/trunk/src/libraries/network/synchronisable/Synchronisable.h	(revision 6417)
@@ -66,6 +66,6 @@
 
   /**
-   * @brief: stores information about a Synchronisable 
-   * 
+   * @brief: stores information about a Synchronisable
+   *
    * This class stores the information about a Synchronisable (objectID_, classID_, creatorID_, dataSize)
    * in an emulated bitset.
@@ -132,5 +132,5 @@
     inline unsigned int getPriority() const { return this->objectFrequency_;}
     inline uint8_t getSyncMode() const { return this->objectMode_; }
-    
+
     void setSyncMode(uint8_t mode);
 
@@ -138,5 +138,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);
+
     void setPriority(unsigned int freq){ objectFrequency_ = freq; }
 
@@ -148,5 +148,5 @@
     bool isMyData(uint8_t* mem);
     bool doSync(int32_t id, uint8_t mode=0x0);
-    
+
     inline void setObjectID(uint32_t id){ this->objectID_ = id; objectMap_[this->objectID_] = this; }
     inline void setClassID(uint32_t id){ this->classID_ = id; }
@@ -167,54 +167,22 @@
   };
 
-  // ================= 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);
-  template <> _NetworkExport void Synchronisable::registerVariable( const Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
-  template <> _NetworkExport void Synchronisable::registerVariable( Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
-  template <> _NetworkExport void Synchronisable::registerVariable( const Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
-  template <> _NetworkExport void Synchronisable::registerVariable( Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
-  template <> _NetworkExport void Synchronisable::registerVariable( const Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
-  template <> _NetworkExport void Synchronisable::registerVariable( Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
-  template <> _NetworkExport void Synchronisable::registerVariable( mbool& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional);
-  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));
+      syncList.push_back(new SynchronisableVariableBidirectional<T>(variable, mode, cb));
       this->dataSize_ += syncList.back()->getSize(state_);
     }
     else
     {
-      syncList.push_back(new SynchronisableVariable<const T>(variable, mode, cb));
+      syncList.push_back(new SynchronisableVariable<T>(variable, mode, cb));
       if ( this->state_ == mode )
         this->dataSize_ += syncList.back()->getSize(state_);
     }
   }
-  
+
+  template <> _NetworkExport void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional);
 
 
-//   template <class T> void Synchronisable::unregisterVariable(T& var){
-//     std::vector<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/trunk/src/libraries/network/synchronisable/SynchronisableSpecialisations.cc
===================================================================
--- code/trunk/src/libraries/network/synchronisable/SynchronisableSpecialisations.cc	(revision 6105)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Dumeni Manatschal, (C) 2007
- *      Oliver Scheuss, (C) 2007
- *   Co-authors:
- *      ...
- *
- */
-
-#include <string>
-#include "util/Math.h"
-#include "Synchronisable.h"
-#include "SynchronisableVariable.h"
-
-// ================ template spezialisation
-  
-  
-namespace orxonox{
-  
-  template <> void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
-  {
-    SynchronisableVariableBase* sv;
-    if (bidirectional)
-      sv = new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb);
-    else
-      sv = new SynchronisableVariable<const std::string>(variable, mode, cb);
-    syncList.push_back(sv);
-    stringList.push_back(sv);
-  }
-  
-  template <> void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    registerVariable(variable.r, mode, cb, bidirectional);
-    registerVariable(variable.g, mode, cb, bidirectional);
-    registerVariable(variable.b, mode, cb, bidirectional);
-    registerVariable(variable.a, mode, cb, bidirectional);
-  }
-  template <> void Synchronisable::registerVariable( ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    return Synchronisable::registerVariable( (const ColourValue&)variable, mode, cb, bidirectional);
-  }
-
-  template <> void Synchronisable::registerVariable( const Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    registerVariable(variable.x, mode, cb, bidirectional);
-    registerVariable(variable.y, mode, cb, bidirectional);
-  }
-  
-  template <> void Synchronisable::registerVariable( const Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    registerVariable(variable.x, mode, cb, bidirectional);
-    registerVariable(variable.y, mode, cb, bidirectional);
-    registerVariable(variable.z, mode, cb, bidirectional);
-  }
-  template <> void Synchronisable::registerVariable( Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    registerVariable( (const Vector3&)variable, mode, cb, bidirectional);
-  }
-
-  template <> void Synchronisable::registerVariable( const Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    registerVariable(variable.x, mode, cb, bidirectional);
-    registerVariable(variable.y, mode, cb, bidirectional);
-    registerVariable(variable.z, mode, cb, bidirectional);
-    registerVariable(variable.w, mode, cb, bidirectional);
-  }
-  template <> void Synchronisable::registerVariable( Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    registerVariable( (const Vector4&)variable, mode, cb, bidirectional);
-  }
-  
-  template <> void Synchronisable::registerVariable( mbool& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    registerVariable(variable.getMemory(), mode, cb, bidirectional);
-  }
-  
-  template <> void Synchronisable::registerVariable( const Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    registerVariable(variable.x, mode, cb, bidirectional);
-    registerVariable(variable.y, mode, cb, bidirectional);
-    registerVariable(variable.z, mode, cb, bidirectional);
-    registerVariable(variable.w, mode, cb, bidirectional);
-  }
-  template <> void Synchronisable::registerVariable( Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)
-  {
-    registerVariable( (const Quaternion&)variable, mode, cb, bidirectional);
-  }
-
-  
-
-} //namespace
Index: code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h	(revision 6105)
+++ code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h	(revision 6417)
@@ -35,5 +35,5 @@
 #include <cassert>
 #include <cstring>
-#include "util/Serialise.h"
+#include "Serialise.h"
 #include "util/TypeTraits.h"
 #include "core/GameMode.h"
@@ -41,5 +41,5 @@
 
 namespace orxonox{
-  
+
   namespace VariableDirection{
     enum Value{
@@ -54,5 +54,5 @@
     };
   }
-  
+
   class _NetworkExport SynchronisableVariableBase
   {
@@ -81,10 +81,9 @@
       virtual inline void* getReference(){ return static_cast<void*>(const_cast<typename Loki::TypeTraits<T>::UnqualifiedType*>(&this->variable_)); }
     protected:
-      
-      T& variable_;
-      uint8_t mode_;
-      NetworkCallbackBase *callback_;
+      T&                       variable_;
+      uint8_t                  mode_;
+      NetworkCallbackBase      *callback_;
   };
-  
+
   template <class T>
   class SynchronisableVariableBidirectional: public SynchronisableVariable<T>
@@ -93,5 +92,5 @@
       SynchronisableVariableBidirectional(T& variable, uint8_t master=Bidirectionality::ServerMaster, NetworkCallbackBase *cb=0);
       virtual ~SynchronisableVariableBidirectional();
-      
+
       virtual inline uint8_t getMode(){ return 0x3; } //this basically is a hack ^^
       virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode);
@@ -113,8 +112,8 @@
     }
   }
-  
+
   template <class T> SynchronisableVariable<T>::~SynchronisableVariable()
   {
-    if (this->callback_ != 0)
+    if (this->callback_)
     {
       NetworkCallbackManager::deleteCallback(this->callback_); //safe call for deletion
@@ -141,14 +140,15 @@
       return;
   // check whether we need to consider a callback
-    if ( this->callback_ != 0 )
-    {
-      if( forceCallback || !checkEquality( this->variable_, mem ) )
-        callback = true;
+    if ( this->callback_ )
+    {
+      callback = forceCallback || !checkEquality( this->variable_, mem );
+    }
+  // now do a callback if neccessary
+    if ( callback )
+    {
+      NetworkCallbackManager::triggerCallback( this->callback_ );
     }
   // write the data
     loadAndIncrease( this->variable_, mem );
-  // now do a callback if neccessary
-    if ( callback )
-      NetworkCallbackManager::triggerCallback( this->callback_ );
   }
 
@@ -216,5 +216,5 @@
             mem += sizeof(varReference_);
             memcpy(static_cast<void*>(const_cast<typename Loki::TypeTraits<T>::UnqualifiedType*>(&this->varBuffer_)), &this->variable_, sizeof(T));
-            if ( this->callback_ != 0 )
+            if ( this->callback_ )
               callback = true;
           }
@@ -235,14 +235,16 @@
           {
             // value changed so remark for callback
-            if ( this->callback_ != 0 )
+            if ( this->callback_ )
               callback = true;
           }
         }
       }
+  // now do a callback if neccessary
+      if ( callback )
+      {
+        NetworkCallbackManager::triggerCallback( this->callback_ );
+      }
   // now write the data
       loadAndIncrease(this->variable_, mem);
-  // now do a callback if neccessary
-      if ( callback )
-        NetworkCallbackManager::triggerCallback( this->callback_ );
     }
 
@@ -251,5 +253,5 @@
       return returnSize( this->variable_ ) + sizeof(varReference_);
     }
-  
+
 
 }
