Index: code/branches/network/TODO
===================================================================
--- code/branches/network/TODO	(revision 1833)
+++ code/branches/network/TODO	(revision 1834)
@@ -5,2 +5,8 @@
 	check that we dont have to much registervar because of virtual function calls
 
+	setvariable mode
+	objectmode
+	friend classes
+	priorities
+	static (sync once)
+	triggerSync
Index: code/branches/network/src/network/ConnectionManager.cc
===================================================================
--- code/branches/network/src/network/ConnectionManager.cc	(revision 1833)
+++ code/branches/network/src/network/ConnectionManager.cc	(revision 1834)
@@ -372,5 +372,5 @@
     orxonox::ObjectList<orxonox::SpaceShip>::iterator it;
     for(it = orxonox::ObjectList<orxonox::SpaceShip>::begin(); it; ++it){
-      if(it->objectID!=id)
+      if(it->getObjectID()!=id)
         continue;
       delete *it;
Index: code/branches/network/src/network/Server.cc
===================================================================
--- code/branches/network/src/network/Server.cc	(revision 1833)
+++ code/branches/network/src/network/Server.cc	(revision 1834)
@@ -326,5 +326,5 @@
     orxonox::SpaceShip *no = dynamic_cast<orxonox::SpaceShip *>(id->fabricate());
     no->classID = id->getNetworkID();
-    client->setShipID(no->objectID);
+    client->setShipID(no->getObjectID());
     no->setPosition(orxonox::Vector3(0,0,80));
     no->setScale(10);
@@ -355,5 +355,5 @@
     gamestates_->removeClient(client);
     while(it){
-      if(it->objectID!=client->getShipID()){
+      if(it->getObjectID()!=client->getShipID()){
         ++it;
         continue;
Index: code/branches/network/src/network/Synchronisable.cc
===================================================================
--- code/branches/network/src/network/Synchronisable.cc	(revision 1833)
+++ code/branches/network/src/network/Synchronisable.cc	(revision 1834)
@@ -65,8 +65,8 @@
     RegisterRootObject(Synchronisable);
     static unsigned int idCounter=0;
-    datasize=0;
     objectFrequency_=1;
-    objectMode_=0x1; // by default do not send data to servere
+    objectMode_=0x1; // by default do not send data to server
     objectID=idCounter++;
+//     COUT(3) << " bump +++" << objectID << " | " << &objectMap_ << std::endl;
     syncList = new std::list<synchronisableVariable *>;
   }
@@ -81,6 +81,7 @@
       for(std::list<synchronisableVariable *>::iterator it = syncList->begin(); it!=syncList->end(); it++)
         delete (*it)->callback;
-      assert(objectMap_[objectID]->objectID==objectID);
-      objectMap_.erase(objectID);
+//       COUT(3) << " bump ---" << objectID << " | " << &objectMap_ << std::endl;
+//       assert(objectMap_[objectID]->objectID==objectID);
+//       objectMap_.erase(objectID);
     }
   }
@@ -92,8 +93,10 @@
    */
   bool Synchronisable::create(){
-    objectMap_[objectID]=this;
-    assert(objectMap_[objectID]==this);
     this->classID = this->getIdentifier()->getNetworkID();
     COUT(4) << "creating synchronisable: setting classid from " << this->getIdentifier()->getName() << " to: " << classID << std::endl;
+    
+//     objectMap_[objectID]=this;
+//     assert(objectMap_[objectID]==this);
+//     assert(objectMap_[objectID]->objectID==objectID);
     return true;
   }
@@ -145,5 +148,10 @@
     assert(getSynchronisable(objectID));
     assert(getSynchronisable(objectID)->objectID==objectID);
-    delete objectMap_[objectID];
+//     delete objectMap_[objectID];
+    Synchronisable *s = getSynchronisable(objectID);
+    if(s)
+      delete s;
+    else
+      return false;
     return true;
   }
@@ -155,9 +163,16 @@
    */
   Synchronisable* Synchronisable::getSynchronisable(unsigned int objectID){
-    std::map<unsigned int, Synchronisable *>::iterator i = objectMap_.find(objectID);
-    if(i==objectMap_.end())
-      return NULL;
-    assert(i->second->objectID==objectID);
-    return (*i).second;
+    orxonox::ObjectList<Synchronisable>::iterator it;
+    for(it = orxonox::ObjectList<Synchronisable>::begin(); it; ++it){
+      if( it->getObjectID()==objectID )
+           return *it;
+    }
+    return NULL;
+
+//     std::map<unsigned int, Synchronisable *>::iterator i = objectMap_.find(objectID);
+//     if(i==objectMap_.end())
+//       return NULL;
+//     assert(i->second->objectID==objectID);
+//     return (*i).second;
   }
 
@@ -181,6 +196,4 @@
     temp->callback = cb;
     COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl;
-    // increase datasize
-    datasize+=sizeof(int)+size;
     //std::cout << "push temp to syncList (at the bottom) " << datasize << std::endl;
     COUT(5) << "Syncronisable::objectID: " << objectID << " this: " << this << " name: " << this->getIdentifier()->getName() << " networkID: " << this->getIdentifier()->getNetworkID() << std::endl;
Index: code/branches/network/src/network/Synchronisable.h
===================================================================
--- code/branches/network/src/network/Synchronisable.h	(revision 1833)
+++ code/branches/network/src/network/Synchronisable.h	(revision 1834)
@@ -44,4 +44,9 @@
 #define REGISTERSTRING_WITHDIR(stringname, mode) registerVar(&stringname, stringname.length()+1, network::STRING, mode)
 
+//TODO: this is only a very ugly hack ...
+namespace orxonox{
+class SpaceShip;
+}
+
 namespace network
 {
@@ -75,5 +80,4 @@
   }SYNCVAR;
 
-
   /**
   * This class is the base class of all the Objects in the universe that need to be synchronised over the network
@@ -83,18 +87,11 @@
   class _NetworkExport Synchronisable : virtual public orxonox::OrxonoxClass{
   public:
+    friend class packet::Gamestate;
+    friend class GamestateClient;
+    friend class Server;
+    friend class orxonox::SpaceShip;
+    virtual ~Synchronisable();
+
     
-    virtual ~Synchronisable();
-    unsigned int objectID;
-    unsigned int classID;
-
-    bool getData(unsigned char*& men, unsigned int id, int mode=0x0);
-    int getSize(unsigned int id, int mode=0x0);
-    bool updateData(unsigned char*& mem, int mode=0x0);
-    bool isMyData(unsigned char* mem);
-    bool doSelection(unsigned int id);
-    void setObjectMode(int mode);
-    void setObjectFrequency(unsigned int freq){ objectFrequency_ = freq; }
-    
-    virtual void registerAllVariables()=0;
     virtual bool create();
     static void setClient(bool b);
@@ -106,12 +103,26 @@
     static unsigned int popDeletedObject(){ unsigned int i = deletedObjects_.front(); deletedObjects_.pop(); return i; }
     
-    
+    inline unsigned int getObjectID(){return objectID;}
+    inline unsigned int getClassID(){return classID;}
   protected:
     Synchronisable();
     void registerVar(void *var, int size, variableType t, int mode=1, NetworkCallbackBase *cb=0);
+    void setObjectMode(int mode);
+    void setObjectFrequency(unsigned int freq){ objectFrequency_ = freq; }
+    virtual void registerAllVariables()=0;
+    
+    
   private:
+    bool getData(unsigned char*& men, unsigned int id, int mode=0x0);
+    int getSize(unsigned int id, int mode=0x0);
+    bool updateData(unsigned char*& mem, int mode=0x0);
+    bool isMyData(unsigned char* mem);
+    bool doSelection(unsigned int id);
     bool isMyTick(unsigned int id);
+    
+    unsigned int objectID;
+    unsigned int classID;
+    
     std::list<synchronisableVariable *> *syncList;
-    int datasize;
     static int state_; // detemines wheter we are server (default) or client
     bool backsync_; // if true the variables with mode > 1 will be synchronised to server (client -> server)
Index: code/branches/network/src/network/packet/Gamestate.cc
===================================================================
--- code/branches/network/src/network/packet/Gamestate.cc	(revision 1833)
+++ code/branches/network/src/network/packet/Gamestate.cc	(revision 1834)
@@ -80,5 +80,9 @@
     return false;
   }
-
+  
+#ifndef NDEBUG
+  std::list<Synchronisable*> slist;
+  std::list<Synchronisable*>::iterator iit;
+#endif
   //start collect data synchronisable by synchronisable
   unsigned char *mem=data_;
@@ -101,4 +105,10 @@
     }// stop allocate additional memory
 
+#ifndef NDEBUG
+    for(iit=slist.begin(); iit!=slist.end(); iit++)
+      assert((*iit)!=*it);
+    slist.push_back(*it);
+#endif
+    
     //if(it->doSelection(id))
     dataMap_[mem-data_]=(*it);  // save the mem location of the synchronisable data
@@ -143,11 +153,13 @@
     {
       s = Synchronisable::fabricate(mem, mode);
-      if(!s)
-        return false;
+      assert(s);
+//       if(!s)
+//         return false;
     }
     else
     {
-      if(!s->updateData(mem, mode))
-        return false;
+      assert(s->updateData(mem, mode));
+      //if(!s->updateData(mem, mode))
+        //return false;
     }
   }
Index: code/branches/network/src/orxonox/objects/BillboardProjectile.cc
===================================================================
--- code/branches/network/src/orxonox/objects/BillboardProjectile.cc	(revision 1833)
+++ code/branches/network/src/orxonox/objects/BillboardProjectile.cc	(revision 1834)
@@ -42,10 +42,7 @@
         RegisterObject(BillboardProjectile);
 
-        if (this->owner_)
-        {
-            this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
-            this->attachObject(this->billboard_.getBillboardSet());
-            this->scale(0.5);
-        }
+        this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
+        this->attachObject(this->billboard_.getBillboardSet());
+        this->scale(0.5);
     }
 
Index: code/branches/network/src/orxonox/objects/ParticleProjectile.cc
===================================================================
--- code/branches/network/src/orxonox/objects/ParticleProjectile.cc	(revision 1833)
+++ code/branches/network/src/orxonox/objects/ParticleProjectile.cc	(revision 1834)
@@ -42,15 +42,14 @@
         RegisterObject(ParticleProjectile);
 
+        this->particles_ = new ParticleInterface("Orxonox/shot2", LODParticle::normal);
+        this->particles_->addToSceneNode(this->getNode());
+        this->particles_->setKeepParticlesInLocalSpace(true);
         if (this->owner_)
         {
-            this->particles_ = new ParticleInterface("Orxonox/shot2", LODParticle::normal);
-            this->particles_->addToSceneNode(this->getNode());
-            this->particles_->getAllEmitters()->setDirection(-this->owner_->getInitialDir());
-            this->particles_->setKeepParticlesInLocalSpace(true);
         }
-        else
-        {
-            this->particles_ = 0;
-        }
+//        else
+//        {
+//            this->particles_ = 0;
+//        }
 
         this->setConfigValues();
@@ -73,3 +72,10 @@
         this->particles_->setEnabled(this->isVisible());
     }
+    
+    bool ParticleProjectile::create(){
+      if(!Projectile::create())
+        return false;
+      this->particles_->getAllEmitters()->setDirection(-this->getOrientation()*Vector3(1,0,0));
+      return true;
+    }
 }
Index: code/branches/network/src/orxonox/objects/ParticleProjectile.h
===================================================================
--- code/branches/network/src/orxonox/objects/ParticleProjectile.h	(revision 1833)
+++ code/branches/network/src/orxonox/objects/ParticleProjectile.h	(revision 1834)
@@ -45,4 +45,6 @@
             virtual void changedVisibility();
             void setConfigValues();
+            
+            virtual bool create();
 
         private:
Index: code/branches/network/src/orxonox/objects/Projectile.cc
===================================================================
--- code/branches/network/src/orxonox/objects/Projectile.cc	(revision 1833)
+++ code/branches/network/src/orxonox/objects/Projectile.cc	(revision 1834)
@@ -54,10 +54,11 @@
         this->smokeTemplateName_ = "Orxonox/smoke4";
 
+        this->setStatic(false);
+        this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
+        
         if (this->owner_)
         {
-            this->setStatic(false);
             this->setOrientation(this->owner_->getOrientation());
             this->setPosition(this->owner_->getPosition());
-            this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
             this->setVelocity(this->owner_->getInitialDir() * this->speed_);
         }
@@ -121,3 +122,7 @@
         delete this;
     }
+    
+    bool Projectile::create(){
+      return WorldEntity::create();
+    }
 }
Index: code/branches/network/src/orxonox/objects/Projectile.h
===================================================================
--- code/branches/network/src/orxonox/objects/Projectile.h	(revision 1833)
+++ code/branches/network/src/orxonox/objects/Projectile.h	(revision 1834)
@@ -45,4 +45,6 @@
             void destroyObject();
             virtual void tick(float dt);
+            
+            virtual bool create();
 
             static float getSpeed()
Index: code/branches/network/src/orxonox/objects/SpaceShip.cc
===================================================================
--- code/branches/network/src/orxonox/objects/SpaceShip.cc	(revision 1833)
+++ code/branches/network/src/orxonox/objects/SpaceShip.cc	(revision 1834)
@@ -78,5 +78,5 @@
       for(it = ObjectList<SpaceShip>::begin(); it; ++it){
 	assert(it->isA(Class(SpaceShip)));
-        if( (it)->myShip_ || (network::Host::running() && network::Host::getShipID()==(it)->objectID) ){
+        if( (it)->myShip_ || (network::Host::running() && network::Host::getShipID()==(it)->getObjectID()) ){
 //	  COUT(1) << "^^^^^^^^^^ myShip_:" << *it << " classname: " << (*it)->getIdentifier()->getName() << " objectid: " << (*it)->objectID << std::endl;
           return *it;
@@ -173,5 +173,5 @@
         if(network::Host::running())
 //          COUT(3) << "this id: " << this->objectID << " myShipID: " << network::Host::getShipID() << std::endl;
-        if(network::Host::running() && objectID == network::Host::getShipID()){
+        if(network::Host::running() && getObjectID() == network::Host::getShipID()){
           if(!network::Host::isServer())
  	    setObjectMode(0x3);
@@ -375,9 +375,9 @@
         if(this->isExactlyA(Class(SpaceShip))){
           getFocus();
-          COUT(3) << "getting focus for obj id: " << objectID << std::endl;
+          COUT(3) << "getting focus for obj id: " << getObjectID() << std::endl;
         }else
-          COUT(3) << "not getting focus (not exactly spaceship) for obj id: " << objectID << std::endl;
+          COUT(3) << "not getting focus (not exactly spaceship) for obj id: " << getObjectID() << std::endl;
       }else
-        COUT(3) << "not getting focus (not my ship) for obj id: " << objectID << std::endl;
+        COUT(3) << "not getting focus (not my ship) for obj id: " << getObjectID() << std::endl;
     }
 
@@ -475,5 +475,5 @@
             projectile->setColour(this->getProjectileColour());
             projectile->create();
-            if (projectile->classID == 0)
+            if (projectile->getClassID() == 0)
             {
               COUT(3) << "generated projectile with classid 0" <<  std::endl; // TODO: remove this output
@@ -570,5 +570,5 @@
         }
 
-        COUT(5) << "steering our ship: " << objectID << std::endl;
+        COUT(5) << "steering our ship: " << getObjectID() << std::endl;
         this->acceleration_.x = 0;
         this->acceleration_.y = 0;
