X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Ffg_io.cxx;h=2ca273f1de2f10de551f747ed98fb5f1747ae028;hb=18d1593c42c2df60d7fb44ace722ca3e8a7fd82c;hp=d8ffefe9a8f1d4b8bd15aef68f31e6d7bbf6e975;hpb=d9bfd5a425df1bad7e3c53a64adce871e299a6b9;p=flightgear.git diff --git a/src/Main/fg_io.cxx b/src/Main/fg_io.cxx index d8ffefe9a..2ca273f1d 100644 --- a/src/Main/fg_io.cxx +++ b/src/Main/fg_io.cxx @@ -26,7 +26,7 @@ #include -#include // atoi() +#include // atoi() #include @@ -67,7 +67,8 @@ #include "globals.hxx" #include "fg_io.hxx" -SG_USING_STD(string); +using std::atoi; +using std::string; FGIO::FGIO() @@ -75,7 +76,7 @@ FGIO::FGIO() } #include -SG_USING_STD(for_each); +using std::for_each; static void delete_ptr( FGProtocol* p ) { delete p; } @@ -242,6 +243,7 @@ FGIO::parse_port_config( const string& config ) string baud = tokens[5]; SG_LOG( SG_IO, SG_INFO, " baud = " << baud ); + SGSerial *ch = new SGSerial( device, baud ); io->set_io_channel( ch ); } else if ( medium == "file" ) { @@ -253,9 +255,17 @@ FGIO::parse_port_config( const string& config ) string file = tokens[4]; SG_LOG( SG_IO, SG_INFO, " file name = " << file ); - bool repeat = false; - if (tokens.size() >= 7 && tokens[6] == "repeat") - repeat = true; + int repeat = 1; + if (tokens.size() >= 7 && tokens[6] == "repeat") { + if (tokens.size() >= 8) { + repeat = atoi(tokens[7].c_str()); + FGGeneric* generic = dynamic_cast(io); + if (generic) + generic->setExitOnError(true); + } else { + repeat = -1; + } + } SGFile *ch = new SGFile( file, repeat ); io->set_io_channel( ch ); } else if ( medium == "socket" ) {