X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Fglobals.cxx;h=af4e693459bce2da14c45ce1e1ebd9342388142d;hb=38226af24ec01e8f0a20d7fd73ef838a69f6ef25;hp=db6eef28c1412a3f717483cce18e672ae2860c2e;hpb=f2a817d1370cde5a94474344a65bacb2f7845352;p=flightgear.git diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index db6eef28c..af4e69345 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,7 @@ #include "fg_props.hxx" #include "fg_io.hxx" - class AircraftResourceProvider : public simgear::ResourceProvider +class AircraftResourceProvider : public simgear::ResourceProvider { public: AircraftResourceProvider() : @@ -74,28 +75,27 @@ public: // test against the aircraft-dir property const char* aircraftDir = fgGetString("/sim/aircraft-dir"); string_list aircraftDirPieces(sgPathBranchSplit(aircraftDir)); - if (aircraftDirPieces.empty() || (aircraftDirPieces.back() != pieces[1])) { - return SGPath(); // current aircraft-dir does not match resource aircraft - } - - SGPath r(aircraftDir); - for (unsigned int i=2; iget_aircraft_paths()); string_list::const_iterator it = dirs.begin(); for (; it != dirs.end(); ++it) { SGPath p(*it, res); if (p.exists()) { - SG_LOG(SG_IO, SG_INFO, "found path:" << aResource << " in aircraft dir: " << r.str()); + SG_LOG(SG_IO, SG_DEBUG, "found path:" << aResource << " in aircraft dir: " << *it); return p; } } // of aircraft path iteration @@ -123,8 +123,6 @@ FGGlobals::FGGlobals() : soundmgr( new SGSoundMgr ), sim_time_sec( 0.0 ), fg_root( "" ), - warp( 0 ), - warp_delta( 0 ), time_params( NULL ), ephem( NULL ), mag( NULL ), @@ -151,6 +149,7 @@ FGGlobals::FGGlobals() : channellist( NULL ) { simgear::ResourceManager::instance()->addProvider(new AircraftResourceProvider()); + simgear::PropertyObjectBase::setDefaultRoot(props); } @@ -167,9 +166,12 @@ FGGlobals::~FGGlobals() // shut down all subsystems, make sure we take down the // AIModels system first. SGSubsystem* ai = subsystem_mgr->remove("ai_model"); - ai->unbind(); - delete ai; + if (ai) { + ai->unbind(); + delete ai; + } + subsystem_mgr->shutdown(); subsystem_mgr->unbind(); delete subsystem_mgr; @@ -180,6 +182,7 @@ FGGlobals::~FGGlobals() delete current_panel; delete ATC_mgr; + controls->unbind(); delete controls; delete channel_options_list; @@ -399,4 +402,24 @@ FGGlobals::get_current_view () const return viewmgr->get_current_view(); } +long int FGGlobals::get_warp() const +{ + return fgGetInt("/sim/time/warp"); +} + +void FGGlobals::set_warp( long int w ) +{ + fgSetInt("/sim/time/warp", w); +} + +long int FGGlobals::get_warp_delta() const +{ + return fgGetInt("/sim/time/warp-delta"); +} + +void FGGlobals::set_warp_delta( long int d ) +{ + fgSetInt("/sim/time/warp-delta", d); +} + // end of globals.cxx