]> git.mxchange.org Git - flightgear.git/commitdiff
Added some test code (currently commented out) to limit a remote visual
authorcurt <curt>
Tue, 27 May 2003 19:15:58 +0000 (19:15 +0000)
committercurt <curt>
Tue, 27 May 2003 19:15:58 +0000 (19:15 +0000)
slave to a specific frame rate (i.e. 30hz).  This is potentially desireable
if you are running on the ragged edge between 30/60 hz ...
It would be nice at some point to make the code a bit more flexible and
configurable so it could be activated from the command line or preferences
file.

src/Network/native_fdm.cxx

index 8a8d743a9dc644fd9ac45409088084f20e70026e..985ac08b4894b17cd2940e13266cb49f9d50a4ae 100644 (file)
@@ -401,10 +401,23 @@ bool FGNativeFDM::process() {
                FGNetFDM2Props( &buf );
            }
        } else {
-           while ( io->read( (char *)(& buf), length ) == length ) {
-               SG_LOG( SG_IO, SG_DEBUG, "Success reading data." );
-               FGNetFDM2Props( &buf );
+            // double dt = 1000000.0 / 30.0;
+            // SGTimeStamp current; current.stamp();
+            int result;
+            result = io->read( (char *)(& buf), length );
+            if ( result == length ) {
+                SG_LOG( SG_IO, SG_DEBUG, "  Success reading data." );
+                FGNetFDM2Props( &buf );
+            }
+           while ( result == length /* || current - last_time < dt */ ) {
+                result = io->read( (char *)(& buf), length );
+                if ( result == length ) {
+                    SG_LOG( SG_IO, SG_DEBUG, "  Success reading data." );
+                    FGNetFDM2Props( &buf );
+                }
+                // current.stamp();
            }
+            // last_time = current;
        }
     }