From: curt Date: Fri, 14 Jul 2000 21:19:18 +0000 (+0000) Subject: Autopilot altitude increment fixes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a7357e2de0766204c254a91d2cc77732012c952f;p=flightgear.git Autopilot altitude increment fixes. Screen snapshot fixes. $FG_SCENERY fixes FGIOChannel api tweaks. --- diff --git a/src/Autopilot/newauto.cxx b/src/Autopilot/newauto.cxx index d6d94c801..e43ae568a 100644 --- a/src/Autopilot/newauto.cxx +++ b/src/Autopilot/newauto.cxx @@ -780,8 +780,21 @@ void FGAutopilot::AltitudeAdjust( double inc ) target_agl = TargetAGL; } - target_alt = ( int ) ( target_alt / inc ) * inc + inc; - target_agl = ( int ) ( target_agl / inc ) * inc + inc; + // cout << "target_agl = " << target_agl << endl; + // cout << "target_agl / inc = " << target_agl / inc << endl; + // cout << "(int)(target_agl / inc) = " << (int)(target_agl / inc) << endl; + + if ( fabs((int)(target_alt / inc) * inc - target_alt) < FG_EPSILON ) { + target_alt += inc; + } else { + target_alt = ( int ) ( target_alt / inc ) * inc + inc; + } + + if ( fabs((int)(target_agl / inc) * inc - target_agl) < FG_EPSILON ) { + target_agl += inc; + } else { + target_agl = ( int ) ( target_agl / inc ) * inc + inc; + } if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) { target_alt *= FEET_TO_METER; diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx index 904321d4b..1695acb8b 100644 --- a/src/GUI/gui.cxx +++ b/src/GUI/gui.cxx @@ -972,6 +972,10 @@ void dumpSnapShot ( puObject *obj ) { void fgDumpSnapShot () { bool show_pu_cursor = false; + int freeze = globals->get_freeze(); + if(!freeze) + globals->set_freeze( true ); + mainMenuBar->hide(); TurnCursorOff(); if ( !puCursorIsHidden() ) { @@ -980,7 +984,7 @@ void fgDumpSnapShot () { } fgInitVisuals(); - fgReshape( current_options.get_xsize(), current_options.get_ysize() ); + fgReshape( current_view.get_winWidth(), current_view.get_winHeight() ); // we need two render frames here to clear the menu and cursor // ... not sure why but doing an extra fgFenderFrame() shoulnd't @@ -1003,6 +1007,8 @@ void fgDumpSnapShot () { mainMenuBar->reveal(); } + if(!freeze) + globals->set_freeze( false ); } diff --git a/src/Main/fg_io.cxx b/src/Main/fg_io.cxx index 84e8696a6..24383e7a1 100644 --- a/src/Main/fg_io.cxx +++ b/src/Main/fg_io.cxx @@ -132,31 +132,29 @@ static FGProtocol *parse_port_config( const string& config ) FG_LOG( FG_IO, FG_INFO, " hertz = " << hertz ); if ( medium == "serial" ) { - SGSerial *ch = new SGSerial; - io->set_io_channel( ch ); - // device name end = config.find(",", begin); if ( end == string::npos ) { return NULL; } - ch->set_device( config.substr(begin, end - begin) ); + string device = config.substr(begin, end - begin); begin = end + 1; - FG_LOG( FG_IO, FG_INFO, " device = " << ch->get_device() ); + FG_LOG( FG_IO, FG_INFO, " device = " << device ); // baud - ch->set_baud( config.substr(begin) ); - FG_LOG( FG_IO, FG_INFO, " baud = " << ch->get_baud() ); + string baud = config.substr(begin); + FG_LOG( FG_IO, FG_INFO, " baud = " << baud ); + SGSerial *ch = new SGSerial( device, baud ); io->set_io_channel( ch ); } else if ( medium == "file" ) { - SGFile *ch = new SGFile; - io->set_io_channel( ch ); - // file name - ch->set_file_name( config.substr(begin) ); - FG_LOG( FG_IO, FG_INFO, " file name = " << ch->get_file_name() ); + string file = config.substr(begin); + FG_LOG( FG_IO, FG_INFO, " file name = " << file ); + + SGFile *ch = new SGFile( file ); + io->set_io_channel( ch ); } else if ( medium == "socket" ) { // hostname end = config.find(",", begin); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 6046cef48..5f5904384 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -230,9 +230,7 @@ fgOPTIONS::fgOPTIONS() : fg_scenery = envp; } else { // Otherwise, default to Scenery being in $FG_ROOT/Scenery - FGPath tmp( fg_root ); - tmp.append( "Scenery" ); - fg_scenery = tmp.str(); + fg_scenery = ""; } airport_id = ""; // default airport id diff --git a/src/Scenery/tilecache.cxx b/src/Scenery/tilecache.cxx index c6c742058..b0f8d9be7 100644 --- a/src/Scenery/tilecache.cxx +++ b/src/Scenery/tilecache.cxx @@ -169,7 +169,13 @@ FGTileCache::fill_in( int index, const FGBucket& p ) tile_cache[index].range_ptr = new ssgRangeSelector; tile_cache[index].tile_bucket = p; - FGPath tile_path( current_options.get_fg_scenery() ); + FGPath tile_path; + if ( current_options.get_fg_scenery() != "" ) { + tile_path.set( current_options.get_fg_scenery() ); + } else { + tile_path.set( current_options.get_fg_root() ); + tile_path.append( "Scenery" ); + } tile_path.append( p.gen_base_path() ); // Load the appropriate data file