Index: /branches/network/src/lib/network/synchronizeable.h
===================================================================
--- /branches/network/src/lib/network/synchronizeable.h	(revision 6860)
+++ /branches/network/src/lib/network/synchronizeable.h	(revision 6861)
@@ -33,7 +33,10 @@
   NWT_SS_VELY,
   NWT_SS_VELZ,
+  NWT_SS_PL_SYNC,
   
   NWT_HS_HOST_ID,
   NWT_HS_NGM_ID,
+  
+  NWT_PL_FLAGS,
   
   NWT_PN_BO_WRITESTATE,
@@ -101,17 +104,23 @@
  * with the same argument names!
  *
+ * id is one int out of that enum on top of this comment it is used to identify
+ * read/write. when you read a value you have to use exactly the same as you used
+ * to write or you will see an assertion failing.
+ *
  * SYNCHELP_WRITE_BEGIN()
- * SYNCHELP_WRITE_INT(i)
- * SYNCHELP_WRITE_FLOAT(f)
- * SYNCHELP_WRITE_BYTE(b)
- * SYNCHELP_WRITE_STRING(s)
+ * SYNCHELP_WRITE_INT(i,id)
+ * SYNCHELP_WRITE_FLOAT(f,id)
+ * SYNCHELP_WRITE_BYTE(b,id)
+ * SYNCHELP_WRITE_STRING(s,id)
  * SYNCHELP_WRITE_N
  *
  * SYNCHELP_READ_BEGIN()
- * SYNCHELP_READ_INT(i)
- * SYNCHELP_READ_FLOAT(f)
- * SYNCHELP_READ_STRING(s,l) l = size of buffer s
- * SYNCHELP_READ_STRINGM(s)  allocates memory for string! you have to free this after
- * SYNCHELP_READ_BYTE(b)
+ * SYNCHELP_READ_INT(i,id)
+ * SYNCHELP_READ_FLOAT(f,id)
+ * SYNCHELP_READ_STRING(s,l,id) l = size of buffer s
+ * SYNCHELP_READ_STRINGM(s,id)  allocates memory for string! you have to delete this later
+ * SYNCHELP_READ_BYTE(b,id)
+ * SYNCHELP_READ_REMAINING() returns the remaining buffer size
+ * SYNCHELP_READ_NEXTBYTE()  reads the next byte but it is not removed from the buffer
  * SYNCHELP_READ_N
  *
@@ -122,4 +131,7 @@
  *  SYNCHELP_READ_FLOAT(size);
  *  SYNCHELP_READ_STRING( textureName, 1024 ); //1024 is the length of textureName
+ *  delete[] textureName;
+ *  textureName = NULL;
+ *  SYNCHELP_READ_STRINGM( texturename );      //this will call new char[strlen()+1] 
  *
  * Example 2:
@@ -130,4 +142,5 @@
  *
  */
+ 
 #define SYNCHELP_WRITE_DEBUG(n) {\
   __synchelp_write_n = Converter::intToByteArray( n, data+__synchelp_write_i, maxLength-__synchelp_write_i ); \
Index: /branches/network/src/world_entities/playable.cc
===================================================================
--- /branches/network/src/world_entities/playable.cc	(revision 6860)
+++ /branches/network/src/world_entities/playable.cc	(revision 6861)
@@ -246,2 +246,43 @@
 {
 }
+
+#define FLAGS_bFire   1
+
+int Playable::writeSync( const byte * data, int length, int sender )
+{
+  SYNCHELP_READ_BEGIN();
+  
+  byte flags;
+  
+  SYNCHELP_READ_BYTE( flags, NWT_PL_FLAGS );
+  
+  bFire = (flags & FLAGS_bFire) != 0;
+  
+  return SYNCHELP_READ_N;
+}
+
+int Playable::readSync( byte * data, int maxLength )
+{
+  SYNCHELP_WRITE_BEGIN();
+  byte flags = 0;
+  
+  if ( bFire )
+    flags |= FLAGS_bFire;
+  
+
+  SYNCHELP_WRITE_BYTE( flags, NWT_PL_FLAGS );
+  oldFlags = flags;
+
+  
+  return SYNCHELP_WRITE_N;
+}
+
+bool Playable::needsReadSync( )
+{
+  byte flags = 0;
+  
+  if ( bFire )
+    flags |= FLAGS_bFire;
+  
+  return flags!=oldFlags;
+}
Index: /branches/network/src/world_entities/playable.h
===================================================================
--- /branches/network/src/world_entities/playable.h	(revision 6860)
+++ /branches/network/src/world_entities/playable.h	(revision 6861)
@@ -54,4 +54,8 @@
     /** @return a List of Events in PEV_* sytle */
     inline const std::list<int>& getEventList() { return this->events; };
+    
+    int       writeSync(const byte* data, int length, int sender);
+    int       readSync(byte* data, int maxLength );
+    bool      needsReadSync();
 
   protected:
@@ -68,4 +72,5 @@
 
     bool                  bFire;              //!< If the Ship is firing.
+    int                   oldFlags;           //!< Used for synchronisation
 
 };
Index: /branches/network/src/world_entities/space_ships/space_ship.cc
===================================================================
--- /branches/network/src/world_entities/space_ships/space_ship.cc	(revision 6860)
+++ /branches/network/src/world_entities/space_ships/space_ship.cc	(revision 6861)
@@ -128,5 +128,5 @@
 
   bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
-  bFire = false;
+
   xMouse = yMouse = 0;
   yInvert = 1;
@@ -517,7 +517,6 @@
 #define MASK_bAscend    16
 #define MASK_bDescend   32
-#define MASK_bFire      64
-#define MASK_bRollL    128
-#define MASK_bRollR    256
+#define MASK_bRollL     64
+#define MASK_bRollR    128
 
 #define DATA_state       1
@@ -526,4 +525,5 @@
 #define DATA_sync        4
 #define DATA_velocity    5
+#define DATA_playables   6
 
 int SpaceShip::writeBytes( const byte * data, int length, int sender )
@@ -548,16 +548,19 @@
     if ( b == DATA_flags )
     {
-      int flags = 0;
-      SYNCHELP_READ_INT( flags, NWT_SS_FLAGS );
-
-      bUp = (flags & MASK_bUp) != 0;
-      bDown = (flags & MASK_bDown) != 0;
-      bLeft = (flags & MASK_bLeft) != 0;
-      bRight = (flags & MASK_bRight) != 0;
-      bAscend = (flags & MASK_bAscend) != 0;
-      bDescend = (flags & MASK_bDescend) != 0;
-      bFire = (flags & MASK_bFire) != 0;
-      bRollL = (flags & MASK_bRollL) != 0;
-      bRollR = (flags & MASK_bRollR) != 0;
+      if ( this->getOwner() != this->getHostID() )
+      {
+        byte flags = 0;
+        SYNCHELP_READ_BYTE( flags, NWT_SS_FLAGS );
+
+        bUp = (flags & MASK_bUp) != 0;
+        bDown = (flags & MASK_bDown) != 0;
+        bLeft = (flags & MASK_bLeft) != 0;
+        bRight = (flags & MASK_bRight) != 0;
+        bAscend = (flags & MASK_bAscend) != 0;
+        bDescend = (flags & MASK_bDescend) != 0;
+        bRollL = (flags & MASK_bRollL) != 0;
+        bRollR = (flags & MASK_bRollR) != 0;
+        
+      }
       
       continue;
@@ -566,8 +569,11 @@
     if ( b == DATA_mouse )
     {
-      SYNCHELP_READ_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW );
-      SYNCHELP_READ_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX );
-      SYNCHELP_READ_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY );
-      SYNCHELP_READ_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ );
+      if ( this->getOwner() != this->getHostID() )
+      {
+        SYNCHELP_READ_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW );
+        SYNCHELP_READ_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX );
+        SYNCHELP_READ_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY );
+        SYNCHELP_READ_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ );
+      }
       
       continue;
@@ -584,7 +590,18 @@
     if ( b == DATA_velocity )
     {
-      SYNCHELP_READ_FLOAT( velocity.x, NWT_SS_VELX );
-      SYNCHELP_READ_FLOAT( velocity.y, NWT_SS_VELY );
-      SYNCHELP_READ_FLOAT( velocity.z, NWT_SS_VELZ );
+      if ( this->getOwner() != this->getHostID() )
+      {
+        SYNCHELP_READ_FLOAT( velocity.x, NWT_SS_VELX );
+        SYNCHELP_READ_FLOAT( velocity.y, NWT_SS_VELY );
+        SYNCHELP_READ_FLOAT( velocity.z, NWT_SS_VELZ );
+      }
+      
+      continue;
+    }
+    
+    if ( b == DATA_playables )
+    {
+      if ( this->getOwner() != this->getHostID() )
+        SYNCHELP_READ_FKT( Playable::writeSync, NWT_SS_PL_SYNC );
     }
   }
@@ -616,5 +633,4 @@
 
     SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_SS_WE_STATE );
-    //SYNCHELP_WRITE_FLOAT( cycle );
 
     return SYNCHELP_WRITE_N;
@@ -631,5 +647,5 @@
   if ( this->getHostID()==this->getOwner() )
   {
-    int mask = 0;
+    byte mask = 0;
 
     if ( bUp )
@@ -643,6 +659,4 @@
     if ( bAscend )
       mask |= MASK_bAscend;
-    if ( bFire )
-      mask |= MASK_bFire;
     if ( bRollL )
       mask |= MASK_bRollL;
@@ -651,12 +665,9 @@
 
 
-    //static float oldxMouse = xMouse + 1.0;
-    //static float oldyMouse = yMouse + 1.0;
-
     if ( mask != oldMask )
     {
       oldMask = mask;
       SYNCHELP_WRITE_BYTE( DATA_flags, NWT_SS_B );
-      SYNCHELP_WRITE_INT( mask, NWT_SS_FLAGS );
+      SYNCHELP_WRITE_BYTE( mask, NWT_SS_FLAGS );
     }
 #define __OFFSET_MDIR_W 0.01
@@ -688,4 +699,10 @@
       SYNCHELP_WRITE_FLOAT( velocity.z, NWT_SS_VELZ );
     }
+    
+    if ( Playable::needsReadSync() )
+    {
+      SYNCHELP_WRITE_BYTE( DATA_playables, NWT_SS_B );
+      SYNCHELP_WRITE_FKT( Playable::readSync, NWT_SS_PL_SYNC );
+    }
 
   }
Index: /branches/network/src/world_entities/space_ships/space_ship.h
===================================================================
--- /branches/network/src/world_entities/space_ships/space_ship.h	(revision 6860)
+++ /branches/network/src/world_entities/space_ships/space_ship.h	(revision 6861)
@@ -56,5 +56,5 @@
     bool                  bAscend;            //!< ascend button pressed.
     bool                  bDescend;           //!< descend button presses.
-    bool                  bFire;              //!< fire button pressed.
+//    bool                  bFire;              //!< fire button pressed.(moved to playable)
     bool                  bRollL;             //!< rolling button pressed (left)
     bool                  bRollR;             //!< rolling button pressed (right)
@@ -80,5 +80,5 @@
     float                 airViscosity;
 
-    int oldMask;
+    byte                  oldMask;            //!< used for synchronisation
 
     ParticleEmitter*      burstEmitter;
