]> git.mxchange.org Git - flightgear.git/commitdiff
Add repeat capability to input from files.
authortimoore <timoore>
Sat, 19 Jul 2008 16:23:05 +0000 (16:23 +0000)
committertimoore <timoore>
Sat, 19 Jul 2008 16:23:05 +0000 (16:23 +0000)
docs-mini/README.IO
src/Main/fg_io.cxx

index 19fd13933814e823d03cc9f2a6370f58792ea01f..9388fcbbaf0106e5af825be66722a12a145b4c86 100644 (file)
@@ -29,7 +29,7 @@ Generic Communication:
     params can be:
     serial port communication:    serial,dir,hz,device,baud,protocol
     socket communication:         socket,dir,hz,machine,port,style,protocol
-    output to a file:             file,dir,hz,filename,protocol
+    i/o to a file:                file,dir,hz,filename,protocol[,repeat]
 
     See README.protocol for how to define a generic protocol.
 
@@ -85,6 +85,11 @@ File I/O:
 
     --native=file,in,10,flight1.fgfs --fdm=external
 
+    You can make the replay from a file loop back to the beginning
+    when it reaches the end of the file with the "repeat" flag:
+
+    --generic=file,in,20,flight.out,playback,repeat
+
 
 Moving Map Example:
 
index 82bcfeb35459a04dd48c1082d04feaae3dcbb6f6..ccecff71b62f0656c6123e044adb5cd0e0ba4b8f 100644 (file)
@@ -182,10 +182,14 @@ FGIO::parse_port_config( const string& config )
            FGRUL *rul = new FGRUL;
            io = rul;
         } else if ( protocol == "generic" ) {
-            int n = 6;
-            if (tokens[1] == "socket")  n++;
-            else if (tokens[1] == "file") n--;
-            FGGeneric *generic = new FGGeneric( tokens[n] );
+            int configToken;
+            if (tokens[1] == "socket")
+                configToken = 7;
+            else if (tokens[1] == "file")
+                configToken = 5;
+            else
+                configToken = 6;
+            FGGeneric *generic = new FGGeneric( tokens[configToken] );
             io = generic;
        } else if ( protocol == "multiplay" ) {
            if ( tokens.size() != 5 ) {
@@ -249,8 +253,10 @@ FGIO::parse_port_config( const string& config )
          
        string file = tokens[4];
        SG_LOG( SG_IO, SG_INFO, "  file name = " << file );
-
-       SGFile *ch = new SGFile( file );
+        bool repeat = false;
+        if (tokens.size() >= 7 && tokens[6] == "repeat")
+            repeat = true;
+       SGFile *ch = new SGFile( file, repeat );
        io->set_io_channel( ch );
     } else if ( medium == "socket" ) {
         if ( tokens.size() < 6) {