Index: /branches/network/src/lib/coord/p_node.cc
===================================================================
--- /branches/network/src/lib/coord/p_node.cc	(revision 6787)
+++ /branches/network/src/lib/coord/p_node.cc	(revision 6788)
@@ -1250,4 +1250,5 @@
 int PNode::readSync( byte * data, int maxLength )
 {
+  //WARNING: if you change this file make sure you also change needsReadSync
   SYNCHELP_WRITE_BEGIN();
 
@@ -1276,5 +1277,5 @@
   {
 
-    PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z);
+    //PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z);
 
     SYNCHELP_WRITE_FLOAT( this->relCoordinate.x, NWT_PN_SCOORX );
@@ -1290,5 +1291,5 @@
   {
 
-    PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z);
+    //PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z);
 
     SYNCHELP_WRITE_FLOAT( this->absDirection.w, NWT_PN_SROTV );
@@ -1305,2 +1306,18 @@
   return SYNCHELP_WRITE_N;
 }
+
+bool PNode::needsReadSync( )
+{
+  if ( fabs( coorx - relCoordinate.x ) > __OFFSET_POS ||
+       fabs( coory - relCoordinate.y ) > __OFFSET_POS ||
+       fabs( coorz - relCoordinate.z ) > __OFFSET_POS )
+    return true;
+
+  if ( fabs( rotw - absDirection.w ) > __OFFSET_ROT ||
+       fabs( rotx - absDirection.v.x ) > __OFFSET_ROT ||
+       fabs( roty - absDirection.v.y ) > __OFFSET_ROT ||
+       fabs( rotz - absDirection.v.z ) > __OFFSET_ROT )
+    return true;
+  
+  return false;
+}
Index: /branches/network/src/lib/coord/p_node.h
===================================================================
--- /branches/network/src/lib/coord/p_node.h	(revision 6787)
+++ /branches/network/src/lib/coord/p_node.h	(revision 6788)
@@ -190,4 +190,5 @@
   int       writeSync(const byte* data, int length, int sender);
   int       readSync(byte* data, int maxLength );
+  bool      needsReadSync();
 
  private:
Index: /branches/network/src/lib/network/synchronizeable.h
===================================================================
--- /branches/network/src/lib/network/synchronizeable.h	(revision 6787)
+++ /branches/network/src/lib/network/synchronizeable.h	(revision 6788)
@@ -195,5 +195,5 @@
 }
 #define SYNCHELP_WRITE_N        __synchelp_write_i
-#define SYNCHELP_WRITE_FKT(f,n)   { \
+#define SYNCHELP_WRITE_FKT(f,n)   { SYNCHELP_WRITE_DEBUG(n); \
                                   __synchelp_write_i += \
                                   f( data+__synchelp_write_i, maxLength-__synchelp_write_i ); \
Index: /branches/network/src/world_entities/space_ships/space_ship.cc
===================================================================
--- /branches/network/src/world_entities/space_ships/space_ship.cc	(revision 6787)
+++ /branches/network/src/world_entities/space_ships/space_ship.cc	(revision 6788)
@@ -133,5 +133,5 @@
   this->getWeaponManager()->changeWeaponConfig(1);
 
-  EventHandler::getInstance()->grabEvents(true);
+  //EventHandler::getInstance()->grabEvents(true);
 
   bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
@@ -551,4 +551,5 @@
 #define DATA_flags       2
 #define DATA_mouse       3
+#define DATA_sync        4
 
 int SpaceShip::writeBytes( const byte * data, int length, int sender )
@@ -558,24 +559,18 @@
   byte b;
   
-  if ( SYNCHELP_READ_REMAINING()>0 && SYNCHELP_READ_NEXTBYTE() == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ )
-  {
-    PRINTF(0)("GOT STATE %d\n", this->getUniqueID());
-    setRequestedSync( false );
-    setIsOutOfSync( false );
-    SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_SS_WE_STATE );
-     //SYNCHELP_READ_FLOAT( cycle );
-
-    return SYNCHELP_READ_N;
-  }
-  
-  if ( this->getOwner() != this->getHostID() )
-    SYNCHELP_READ_FKT( PNode::writeSync, NWT_SS_PN_SYNC );
-
   while ( SYNCHELP_READ_REMAINING()>0 )
   {
     SYNCHELP_READ_BYTE( b, NWT_SS_B );
-
-    //TODO: do not recieve data if you are the owner
-    if ( b == DATA_flags /*&& this->getHostID()!=this->getOwner()*/ )
+    
+    if ( b == DATA_state )
+    {
+      setRequestedSync( false );
+      setIsOutOfSync( false );
+      SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_SS_WE_STATE );
+
+      continue;
+    }
+    
+    if ( b == DATA_flags )
     {
       int flags = 0;
@@ -591,9 +586,9 @@
       bRollL = (flags & MASK_bRollL) != 0;
       bRollR = (flags & MASK_bRollR) != 0;
-
-    }
-
-    //TODO: do not recieve data if you are the owner
-    if ( b == DATA_mouse /*&& this->getHostID()!=this->getOwner()*/ )
+      
+      continue;
+    }
+    
+    if ( b == DATA_mouse )
     {
       SYNCHELP_READ_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW );
@@ -601,15 +596,64 @@
       SYNCHELP_READ_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY );
       SYNCHELP_READ_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ );
+      
+      continue;
+    }
+    
+    if ( b == DATA_sync )
+    {
+      if ( this->getOwner() != this->getHostID() )
+        SYNCHELP_READ_FKT( PNode::writeSync, NWT_SS_PN_SYNC );
+      
+      continue;
+    }
+  }
+  
+#if 0
+  if ( SYNCHELP_READ_REMAINING()>0 && SYNCHELP_READ_NEXTBYTE() == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ )
+  {
+    PRINTF(0)("GOT STATE %d\n", this->getUniqueID());
+    setRequestedSync( false );
+    setIsOutOfSync( false );
+    SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_SS_WE_STATE );
+     //SYNCHELP_READ_FLOAT( cycle );
+
+    return SYNCHELP_READ_N;
+  }
+  
+  if ( this->getOwner() != this->getHostID() )
+    SYNCHELP_READ_FKT( PNode::writeSync, NWT_SS_PN_SYNC );
+
+  while ( SYNCHELP_READ_REMAINING()>0 )
+  {
+    SYNCHELP_READ_BYTE( b, NWT_SS_B );
+
+    //TODO: do not recieve data if you are the owner
+    if ( b == DATA_flags /*&& this->getHostID()!=this->getOwner()*/ )
+    {
+      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;
+
+    }
+
+    //TODO: do not recieve data if you are the owner
+    if ( b == DATA_mouse /*&& this->getHostID()!=this->getOwner()*/ )
+    {
+      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 ( b == DATA_mouse && this->getHostID()!=this->getOwner() )
-  {
-    SYNCHELP_READ_FLOAT( xMouse );
-    SYNCHELP_READ_FLOAT( yMouse );
-    SYNCHELP_READ_FLOAT( mouseSensitivity );
-    SYNCHELP_READ_FLOAT( cycle );
-}*/
-
+#endif
   return SYNCHELP_READ_N;
 }
@@ -645,6 +689,9 @@
   *reciever = 0;
   
-  if ( this->getOwner() == this->getHostID() )
+  if ( this->getOwner() == this->getHostID() && PNode::needsReadSync() )
+  {
+    SYNCHELP_WRITE_BYTE( DATA_sync, NWT_SS_B );
     SYNCHELP_WRITE_FKT( PNode::readSync, NWT_SS_PN_SYNC );
+  }
 
   if ( this->getHostID()==this->getOwner() )
@@ -699,29 +746,3 @@
 }
 
-int SpaceShip::writeState(const byte* data, int length, int sender)
-{
-  SYNCHELP_READ_BEGIN();
-  
-  return SYNCHELP_READ_N;
-}
-
-int SpaceShip::readState(byte* data, int maxLength )
-{
-  SYNCHELP_WRITE_BEGIN();
-  
-  return SYNCHELP_WRITE_N;
-}
-
-int SpaceShip::writeSync(const byte* data, int length, int sender)
-{
-  SYNCHELP_READ_BEGIN();
-  
-  return SYNCHELP_READ_N;
-}
-
-int SpaceShip::readSync(byte* data, int maxLength )
-{
-  SYNCHELP_WRITE_BEGIN();
-  
-  return SYNCHELP_WRITE_N;
-}
+
Index: /branches/network/src/world_entities/space_ships/space_ship.h
===================================================================
--- /branches/network/src/world_entities/space_ships/space_ship.h	(revision 6787)
+++ /branches/network/src/world_entities/space_ships/space_ship.h	(revision 6788)
@@ -44,10 +44,4 @@
     virtual int       writeBytes(const byte* data, int length, int sender);
     virtual int       readBytes(byte* data, int maxLength, int * reciever);
-    
-    int       writeState(const byte* data, int length, int sender);
-    int       readState(byte* data, int maxLength );
-    int       writeSync(const byte* data, int length, int sender);
-    int       readSync(byte* data, int maxLength );
-
 
   private:
