]> git.mxchange.org Git - flightgear.git/commitdiff
Autopilot altitude increment fixes.
authorcurt <curt>
Fri, 14 Jul 2000 21:19:18 +0000 (21:19 +0000)
committercurt <curt>
Fri, 14 Jul 2000 21:19:18 +0000 (21:19 +0000)
Screen snapshot fixes.
$FG_SCENERY fixes
FGIOChannel api tweaks.

src/Autopilot/newauto.cxx
src/GUI/gui.cxx
src/Main/fg_io.cxx
src/Main/options.cxx
src/Scenery/tilecache.cxx

index d6d94c801356480ec4c9e8db4d97537a3bad574c..e43ae568acab010db6c6eae3fa0794566885da55 100644 (file)
@@ -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;
index 904321d4b951cb12018b8ee6e9de69540a304411..1695acb8bfabadd73481b82003180fbc17000578 100644 (file)
@@ -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 );
 }
 
 
index 84e8696a6dc963a5c1fd994aa9af42f6921576a9..24383e7a1b20d5dfacab786d3d1153398108dff2 100644 (file)
@@ -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);
index 6046cef48d67606413f58109ed0982ed2827dc7d..5f59043847118e4d95351a27f583e1359a63fa04 100644 (file)
@@ -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
index c6c742058337b6427203b11e2154761af50c2847..b0f8d9be72f205a631e5fe8fcd5475baa2f39099 100644 (file)
@@ -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