X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Ffg_init.cxx;h=fd245f754e788245edc7aa53a1bde06c3d821c65;hb=552c3149aeaaea7abdc00eee644ef81414644e7b;hp=a23532db1a6cbc04663598813faaaf608e4f618c;hpb=76b609738fc860118f3409348e586d5ce3ca9ce0;p=flightgear.git diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index a23532db1..fd245f754 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -102,6 +101,7 @@ #include #include #include +#include #include #include #include @@ -597,6 +597,10 @@ bool fgInitConfig ( int argc, char **argv ) { if (fg_home) config = fg_home; + SGPath home_export(config.str()); + home_export.append("Export/dummy"); + home_export.create_dir(0777); + // Set /sim/fg-home and don't allow malign code to override it until // Nasal security is set up. Use FG_HOME if necessary. SGPropertyNode *home = fgGetNode("/sim", true); @@ -939,11 +943,10 @@ static bool fgSetPosFromCarrier( const string& carrier, const string& posid ) { // Set current_options lon/lat given an airport id and heading (degrees) static bool fgSetPosFromFix( const string& id ) { - FGFix* fix; - - // set initial position from runway and heading - if ( !globals->get_fixlist()->query( id.c_str(), fix ) ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate NAV = " << id ); + FGPositioned::TypeFilter fixFilter(FGPositioned::FIX); + FGPositioned* fix = FGPositioned::findNextWithPartialId(NULL, id, &fixFilter); + if (!fix) { + SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate fix = " << id ); return false; } @@ -951,7 +954,6 @@ static bool fgSetPosFromFix( const string& id ) return true; } - /** * Initialize vor/ndb/ils/fix list management and query systems (as * well as simple airport db list) @@ -967,16 +969,12 @@ fgInitNav () SGPath p_metar( globals->get_fg_root() ); p_metar.append( "Airports/metar.dat" ); - FGAirportList *airports = new FGAirportList(); - globals->set_airports( airports ); - - fgAirportDBLoad( airports, aptdb.str(), p_metar.str() ); + fgAirportDBLoad( aptdb.str(), p_metar.str() ); FGNavList *navlist = new FGNavList; FGNavList *loclist = new FGNavList; FGNavList *gslist = new FGNavList; FGNavList *dmelist = new FGNavList; - FGNavList *mkrlist = new FGNavList; FGNavList *tacanlist = new FGNavList; FGNavList *carrierlist = new FGNavList; FGTACANList *channellist = new FGTACANList; @@ -985,12 +983,11 @@ fgInitNav () globals->set_loclist( loclist ); globals->set_gslist( gslist ); globals->set_dmelist( dmelist ); - globals->set_mkrlist( mkrlist ); globals->set_tacanlist( tacanlist ); globals->set_carrierlist( carrierlist ); globals->set_channellist( channellist ); - if ( !fgNavDBInit(navlist, loclist, gslist, dmelist, mkrlist, tacanlist, carrierlist, channellist) ) { + if ( !fgNavDBInit(navlist, loclist, gslist, dmelist, tacanlist, carrierlist, channellist) ) { SG_LOG( SG_GENERAL, SG_ALERT, "Problems loading one or more navigational database" ); } @@ -1000,7 +997,6 @@ fgInitNav () p_fix.append( "Navaids/fix.dat" ); FGFixList *fixlist = new FGFixList; fixlist->init( p_fix ); - globals->set_fixlist( fixlist ); SG_LOG(SG_GENERAL, SG_INFO, " Airways"); SGPath p_awy( globals->get_fg_root() ); @@ -1784,6 +1780,14 @@ void reInit(void) // from gui_local.cxx -- TODO merge with fgReInitSubsystems() int xsize = fgGetInt("/sim/startup/xsize"); int ysize = fgGetInt("/sim/startup/ysize"); + // viewports also needs to be saved/restored as + // restoreInitialState() overwrites these + SGPropertyNode *guiNode = new SGPropertyNode; + SGPropertyNode *cameraNode = new SGPropertyNode; + SGPropertyNode *cameraGroupNode = fgGetNode("/sim/rendering/camera-group"); + copyProperties(cameraGroupNode->getChild("camera"), cameraNode); + copyProperties(cameraGroupNode->getChild("gui"), guiNode); + globals->restoreInitialState(); // update our position based on current presets @@ -1794,6 +1798,12 @@ void reInit(void) // from gui_local.cxx -- TODO merge with fgReInitSubsystems() fgSetInt("/sim/startup/xsize", xsize); fgSetInt("/sim/startup/ysize", ysize); + copyProperties(cameraNode, cameraGroupNode->getChild("camera")); + copyProperties(guiNode, cameraGroupNode->getChild("gui")); + + delete guiNode; + delete cameraNode; + SGTime *t = globals->get_time_params(); delete t; t = fgInitTime();