Index: /branches/network/src/lib/network/network_game_manager.cc
===================================================================
--- /branches/network/src/lib/network/network_game_manager.cc	(revision 6418)
+++ /branches/network/src/lib/network/network_game_manager.cc	(revision 6419)
@@ -23,5 +23,7 @@
 #include "network_stream.h"
 #include "converter.h"
+
 #include "p_node.h"
+
 
 /* include your own header */
@@ -392,4 +394,6 @@
   //PRINTF(0)("SendEntityList: n = %d\n", networkStream->getSyncCount()-2 );
 
+  int n = 0;
+
   while ( it != e )
   {
@@ -404,4 +408,18 @@
     if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getOwner()) ) )
       return;
+
+
+    PRINTF(0)("id = %x %s %s\n", (int)((*it)->getLeafClassID()), (*it)->getClassName(), (*it)->getName());
+
+
+    /*if ( (*it)->isA(CL_WORLD_ENTITY) )
+    {
+      n = dynamic_cast<WorldEntity*>((*it))->readState( outBuffer[userID].buffer, outBuffer[userID].maxLength-outBuffer[userID].length );
+      if ( n = 0 )
+      {
+        PRINTF(2)("n = 0\n");
+      }
+      outBuffer[userID].length += n;
+  }*/
 
     it++;
@@ -437,5 +455,5 @@
  * @param owner: owner of this synchronizealbe
  */
-void NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )
+BaseObject* NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )
 {
   BaseObject * b = Factory::fabricate( classID );
@@ -444,5 +462,5 @@
   {
     PRINTF(1)("Could not fabricate Object with classID %x\n", classID);
-    return;
+    return NULL;
   }
 
@@ -456,4 +474,5 @@
       s->setIsOutOfSync( true );
     PRINTF(0)("Fabricated %s with id %d\n", s->getClassName(), s->getUniqueID());
+    return b;
   }
   else
@@ -462,4 +481,5 @@
     delete b;
   }
+  return NULL;
 }
 
@@ -696,9 +716,24 @@
     i += Converter::byteArrayToInt( &data[i], &owner );
 
+    PRINTF(0)("before fabricate\n");
     if ( classID != CL_NETWORK_GAME_MANAGER && classID != CL_HANDSHAKE )
-      doCreateEntity( (ClassID)classID, uniqueID, owner );
-
-  }
+    {
+      BaseObject* b = doCreateEntity( (ClassID)classID, uniqueID, owner );
+
+      /*if ( b != NULL )
+      {
+        if ( b->isA(CL_WORLD_ENTITY) )
+        {
+          int n = dynamic_cast<WorldEntity*>(b)->writeState( data, length, sender );
+
+          i += n;
+        }
+    }*/
+    }
+
+  }
+
   PNode::getNullParent()->debugNode( 0 );
+
   return true;
 }
Index: /branches/network/src/lib/network/network_game_manager.h
===================================================================
--- /branches/network/src/lib/network/network_game_manager.h	(revision 6418)
+++ /branches/network/src/lib/network/network_game_manager.h	(revision 6419)
@@ -94,5 +94,5 @@
     void executeRequestSync( int uniqueID, int user );
 
-    void doCreateEntity(ClassID classID, int uniqueID, int owner);
+    BaseObject* doCreateEntity(ClassID classID, int uniqueID, int owner);
     void doRemoveEntity(int uniqueID);
     void doRequestSync(int uniqueID, int userID);
Index: /branches/network/src/subprojects/network/network_unit_test.cc
===================================================================
--- /branches/network/src/subprojects/network/network_unit_test.cc	(revision 6418)
+++ /branches/network/src/subprojects/network/network_unit_test.cc	(revision 6419)
@@ -136,5 +136,5 @@
 
   /* create a server stream */
-  nm->createServer(*serverSync, port);
+  nm->createServer(port);
 
   /* esatblish a connection */
@@ -289,5 +289,5 @@
   printf("%f = ", f);
   printf(s); printf("\n");
-  
+
   byte* res = Converter::floatToByteArray(f);
   printf("Byte Array: ");
@@ -295,5 +295,5 @@
     printf("%i  ", res[i]);
   printf("\n");
-  
+
   float b = Converter::byteArrayToFloat(res);
   printf("ReConvert: %f \n", b);
@@ -305,5 +305,5 @@
   printf("### %f = ", f);
   printf(s); printf("\n");
-  
+
   byte* res = Converter::_floatToByteArray(f);
   printf("Byte Array: ");
@@ -311,5 +311,5 @@
     printf("%i  ", res[i]);
   printf("\n");
-  
+
   float b = Converter::_byteArrayToFloat(res);
   printf("ReConvert: %f \n", b);
@@ -324,46 +324,46 @@
     printf("%i  ", res[i]);
   printf("\n");
-  
+
   int z = Converter::byteArrayToInt(res);
-  
+
   printf("ReConvert: %i\n", z);
 
-  
+
   //float a = 5.4f;
   //float b = 2.0f;
   //printf("%f mod %f = %f", a, b, a % b);
-  
-  printf("\n");
-  
+
+  printf("\n");
+
   */
   /*
   float y;
   char* s;
-  
+
   y = 12.0f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = 24549026.0f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = 12.4e20f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = 4.7824f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = -4.7824f;
   s = Converter::floatToBinString(y);
   printf("%f = ", y);
   printf(s); printf("\n");
-  
+
   y = -14.35e14f;
   s = Converter::floatToBinString(y);
@@ -371,13 +371,13 @@
   printf(s); printf("\n");
                                                             */
-  
-  
+
+
   /*
   float a = 12.3f;
-  
+
   char* s = Converter::floatToBinString(a);
   printf("%f = ", a);
   printf(s); printf("\n");
-  
+
   byte* res = Converter::floatToByteArray(a);
   printf("Byte Array: \n");
@@ -385,5 +385,5 @@
     printf("%i  ", res[i]);
   printf("\n");
-  
+
   float b = Converter::byteArrayToFloat(res);
   printf("ReConvert: %f \n", b);
@@ -392,9 +392,9 @@
 //  testFloatConverter(134.26455646546548741661675165f); printf("\n");
  // testFloatConverter(35.67e14f); printf("\n");
-  
+
   testFloatConverter(12.3e-7f); printf("\n");
   testFloatConverter(134.26455646546548741661675165f); printf("\n");
   testFloatConverter(35.67e14f); printf("\n");
-  
+
   return 0;
 }
Index: /branches/network/src/world_entities/power_ups/laser_power_up.cc
===================================================================
--- /branches/network/src/world_entities/power_ups/laser_power_up.cc	(revision 6418)
+++ /branches/network/src/world_entities/power_ups/laser_power_up.cc	(revision 6419)
@@ -19,4 +19,5 @@
 #include "factory.h"
 #include "state.h"
+#include "network_game_manager.h"
 
 #include "primitive_model.h"
@@ -118,2 +119,40 @@
 }
 
+int LaserPowerUp::writeBytes( const byte * data, int length, int sender )
+{
+  setRequestedSync( false );
+  setIsOutOfSync( false );
+
+  SYNCHELP_READ_BEGIN();
+
+  SYNCHELP_READ_FKT( PowerUp::writeState );
+
+  return SYNCHELP_READ_N;
+}
+
+
+
+int LaserPowerUp::readBytes( byte * data, int maxLength, int * reciever )
+{
+  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
+  {
+    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
+    setRequestedSync( true );
+  }
+
+  int rec = this->getRequestSync();
+  if ( rec > 0 )
+  {
+    *reciever = rec;
+
+    SYNCHELP_WRITE_BEGIN();
+
+    SYNCHELP_WRITE_FKT( PowerUp::readState );
+
+    return SYNCHELP_WRITE_N;
+  }
+
+  *reciever = 0;
+  return 0;
+}
+
Index: /branches/network/src/world_entities/power_ups/laser_power_up.h
===================================================================
--- /branches/network/src/world_entities/power_ups/laser_power_up.h	(revision 6418)
+++ /branches/network/src/world_entities/power_ups/laser_power_up.h	(revision 6419)
@@ -23,4 +23,7 @@
   virtual void draw() const;
 
+  virtual int writeBytes(const byte* data, int length, int sender);
+  virtual int readBytes(byte* data, int maxLength, int * reciever );
+
   private:
    void init();
Index: /branches/network/src/world_entities/power_ups/param_power_up.cc
===================================================================
--- /branches/network/src/world_entities/power_ups/param_power_up.cc	(revision 6418)
+++ /branches/network/src/world_entities/power_ups/param_power_up.cc	(revision 6419)
@@ -64,5 +64,7 @@
   static_cast<PowerUp*>(this)->loadParams(root);
   LoadParam(root, "type", this, ParamPowerUp, setType);
-  if(root!=NULL && root->FirstChildElement("value") != NULL) {
+
+  if( root != NULL && root->FirstChildElement("value") != NULL) {
+
     LoadParam(root, "value", this, ParamPowerUp, setValue);
   }
Index: /branches/network/src/world_entities/power_ups/power_up.cc
===================================================================
--- /branches/network/src/world_entities/power_ups/power_up.cc	(revision 6418)
+++ /branches/network/src/world_entities/power_ups/power_up.cc	(revision 6419)
@@ -54,5 +54,5 @@
 void PowerUp::collidesWith (WorldEntity* entity, const Vector& location)
 {
- if(entity->isA(CL_EXTENDABLE))
+  if(entity->isA(CL_EXTENDABLE))
   {
     if(dynamic_cast<Extendable*>(entity)->pickup(this))
@@ -96,2 +96,28 @@
 }
 
+/**
+ * data copied in data will bee sent to another host
+ * @param data pointer to data
+ * @param maxLength max length of data
+ * @return the number of bytes writen
+ */
+int PowerUp::readState( byte * data, int maxLength )
+{
+  SYNCHELP_WRITE_BEGIN();
+  SYNCHELP_WRITE_FKT( WorldEntity::readState );
+  return SYNCHELP_WRITE_N;
+}
+
+/**
+ * Writes data from network containing information about the state
+ * @param data pointer to data
+ * @param length length of data
+ * @param sender hostID of sender
+ */
+int PowerUp::writeState( const byte * data, int length, int sender )
+{
+  SYNCHELP_READ_BEGIN();
+  SYNCHELP_READ_FKT( WorldEntity::writeState );
+  return SYNCHELP_READ_N;
+}
+
Index: /branches/network/src/world_entities/power_ups/power_up.h
===================================================================
--- /branches/network/src/world_entities/power_ups/power_up.h	(revision 6418)
+++ /branches/network/src/world_entities/power_ups/power_up.h	(revision 6419)
@@ -26,4 +26,7 @@
   void setRespawnType(const char* type);
 
+  int       writeState(const byte* data, int length, int sender);
+  int       readState(byte* data, int maxLength );
+
 protected:
   PowerUp(float r, float g, float b);
Index: /branches/network/src/world_entities/power_ups/turret_power_up.cc
===================================================================
--- /branches/network/src/world_entities/power_ups/turret_power_up.cc	(revision 6418)
+++ /branches/network/src/world_entities/power_ups/turret_power_up.cc	(revision 6419)
@@ -18,4 +18,5 @@
 #include "turret_power_up.h"
 #include "factory.h"
+#include "network_game_manager.h"
 #include "state.h"
 
@@ -118,2 +119,39 @@
 }
 
+int TurretPowerUp::writeBytes( const byte * data, int length, int sender )
+{
+  setRequestedSync( false );
+  setIsOutOfSync( false );
+
+  SYNCHELP_READ_BEGIN();
+
+  SYNCHELP_READ_FKT( PowerUp::writeState );
+
+  return SYNCHELP_READ_N;
+}
+
+
+
+int TurretPowerUp::readBytes( byte * data, int maxLength, int * reciever )
+{
+  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
+  {
+    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
+    setRequestedSync( true );
+  }
+
+  int rec = this->getRequestSync();
+  if ( rec > 0 )
+  {
+    *reciever = rec;
+
+    SYNCHELP_WRITE_BEGIN();
+
+    SYNCHELP_WRITE_FKT( PowerUp::readState );
+
+    return SYNCHELP_WRITE_N;
+  }
+
+  *reciever = 0;
+  return 0;
+}
Index: /branches/network/src/world_entities/power_ups/turret_power_up.h
===================================================================
--- /branches/network/src/world_entities/power_ups/turret_power_up.h	(revision 6418)
+++ /branches/network/src/world_entities/power_ups/turret_power_up.h	(revision 6419)
@@ -23,4 +23,7 @@
   virtual void draw() const;
 
+  virtual int writeBytes(const byte* data, int length, int sender);
+  virtual int readBytes(byte* data, int maxLength, int * reciever );
+
   private:
    void init();
Index: /branches/network/src/world_entities/power_ups/weapon_power_up.cc
===================================================================
--- /branches/network/src/world_entities/power_ups/weapon_power_up.cc	(revision 6418)
+++ /branches/network/src/world_entities/power_ups/weapon_power_up.cc	(revision 6419)
@@ -20,4 +20,5 @@
 #include "state.h"
 #include "list.h"
+#include "network_game_manager.h"
 
 #include "primitive_model.h"
@@ -85,2 +86,44 @@
   this->weapon = dynamic_cast<Weapon*>(Factory::fabricate(name));
 }
+
+int WeaponPowerUp::writeBytes( const byte * data, int length, int sender )
+{
+  setRequestedSync( false );
+  setIsOutOfSync( false );
+
+  SYNCHELP_READ_BEGIN();
+
+  SYNCHELP_READ_FKT( PowerUp::writeState );
+
+  //TODO: sync weapon class ( see loadParams )
+
+  return SYNCHELP_READ_N;
+}
+
+
+
+int WeaponPowerUp::readBytes( byte * data, int maxLength, int * reciever )
+{
+  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
+  {
+    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
+    setRequestedSync( true );
+  }
+
+  int rec = this->getRequestSync();
+  if ( rec > 0 )
+  {
+    *reciever = rec;
+
+    SYNCHELP_WRITE_BEGIN();
+
+    SYNCHELP_WRITE_FKT( PowerUp::readState );
+
+    //TODO: sync weapon class ( see loadParams )
+
+    return SYNCHELP_WRITE_N;
+  }
+
+  *reciever = 0;
+  return 0;
+}
Index: /branches/network/src/world_entities/power_ups/weapon_power_up.h
===================================================================
--- /branches/network/src/world_entities/power_ups/weapon_power_up.h	(revision 6418)
+++ /branches/network/src/world_entities/power_ups/weapon_power_up.h	(revision 6419)
@@ -22,4 +22,7 @@
   void setWeaponClass(const char* name);
 
+  virtual int writeBytes(const byte* data, int length, int sender);
+  virtual int readBytes(byte* data, int maxLength, int * reciever );
+
 protected:
   virtual void respawn();
Index: /branches/network/src/world_entities/world_entity.cc
===================================================================
--- /branches/network/src/world_entities/world_entity.cc	(revision 6418)
+++ /branches/network/src/world_entities/world_entity.cc	(revision 6419)
@@ -106,4 +106,5 @@
 void WorldEntity::loadModel(const char* fileName, float scaling, unsigned int modelNumber)
 {
+  this->scaling = scaling;
   if ( fileName != NULL && strcmp(fileName, "") )
   {
