X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FEnvironment%2Fenvironment_mgr.cxx;h=9aca5b0b5a86c7e6e20a7456a3ccf18aed6e4d1b;hb=ee1c8a8d662a0398711ee17c53dd64d249d2e030;hp=312d52129937aa98a8021080d6634960e4a7b4c3;hpb=c112b8b8e169a427e8cb0da871347e5c10031479;p=flightgear.git diff --git a/src/Environment/environment_mgr.cxx b/src/Environment/environment_mgr.cxx index 312d52129..9aca5b0b5 100644 --- a/src/Environment/environment_mgr.cxx +++ b/src/Environment/environment_mgr.cxx @@ -31,8 +31,8 @@ #include #include
-#include
#include
+#include #include #include "environment.hxx" @@ -43,8 +43,9 @@ #include "precipitation_mgr.hxx" #include "ridge_lift.hxx" #include "terrainsampler.hxx" -#include "Airports/simple.hxx" +#include "Airports/airport.hxx" #include "gravity.hxx" +#include "magvarmanager.hxx" class FG3DCloudsListener : public SGPropertyChangeListener { public: @@ -93,6 +94,8 @@ FGEnvironmentMgr::FGEnvironmentMgr () : set_subsystem("precipitation", new FGPrecipitationMgr); set_subsystem("terrainsampler", Environment::TerrainSampler::createInstance( fgGetNode("/environment/terrain", true ) )); set_subsystem("ridgelift", new FGRidgeLift); + + set_subsystem("magvar", new FGMagVarManager); } FGEnvironmentMgr::~FGEnvironmentMgr () @@ -119,35 +122,43 @@ FGEnvironmentMgr::~FGEnvironmentMgr () remove_subsystem("controller"); delete subsys; + subsys = get_subsystem("magvar"); + remove_subsystem("magvar"); + delete subsys; + delete fgClouds; delete _environment; delete _3dCloudsEnableListener; } -void -FGEnvironmentMgr::init () +SGSubsystem::InitStatus FGEnvironmentMgr::incrementalInit() { - SG_LOG( SG_ENVIRONMENT, SG_INFO, "Initializing environment subsystem"); - SGSubsystemGroup::init(); - fgClouds->Init(); - - // FIXME: is this really part of the environment_mgr? - // Initialize the longitude, latitude and altitude to the initial position - // of the aircraft so that the atmospheric properties (pressure, temperature - // and density) can be initialized accordingly. - _altitude_n->setDoubleValue(fgGetDouble("/sim/presets/altitude-ft")); - _longitude_n->setDoubleValue(fgGetDouble("/sim/presets/longitude-deg")); - _latitude_n->setDoubleValue(fgGetDouble("/sim/presets/latitude-deg")); - globals->get_event_mgr()->addTask("updateClosestAirport", this, - &FGEnvironmentMgr::updateClosestAirport, 30 ); + InitStatus r = SGSubsystemGroup::incrementalInit(); + if (r == INIT_DONE) { + fgClouds->Init(); + + // FIXME: is this really part of the environment_mgr? + // Initialize the longitude, latitude and altitude to the initial position + // of the aircraft so that the atmospheric properties (pressure, temperature + // and density) can be initialized accordingly. + _altitude_n->setDoubleValue(fgGetDouble("/sim/presets/altitude-ft")); + _longitude_n->setDoubleValue(fgGetDouble("/sim/presets/longitude-deg")); + _latitude_n->setDoubleValue(fgGetDouble("/sim/presets/latitude-deg")); + + globals->get_event_mgr()->addTask("updateClosestAirport", this, + &FGEnvironmentMgr::updateClosestAirport, 30 ); + } + + return r; } void FGEnvironmentMgr::shutdown() { globals->get_event_mgr()->removeTask("updateClosestAirport"); + SGSubsystemGroup::shutdown(); } void @@ -222,10 +233,30 @@ FGEnvironmentMgr::bind () &SGSky::get_3dCloudVisRange, &SGSky::set_3dCloudVisRange); + _tiedProperties.Tie("clouds3d-impostor-range", _sky, + &SGSky::get_3dCloudImpostorDistance, + &SGSky::set_3dCloudImpostorDistance); + + _tiedProperties.Tie("clouds3d-lod1-range", _sky, + &SGSky::get_3dCloudLoD1Range, + &SGSky::set_3dCloudLoD1Range); + + _tiedProperties.Tie("clouds3d-lod2-range", _sky, + &SGSky::get_3dCloudLoD2Range, + &SGSky::set_3dCloudLoD2Range); + _tiedProperties.Tie("clouds3d-wrap", _sky, &SGSky::get_3dCloudWrap, &SGSky::set_3dCloudWrap); + _tiedProperties.Tie("clouds3d-use-impostors", _sky, + &SGSky::get_3dCloudUseImpostors, + &SGSky::set_3dCloudUseImpostors); + + _tiedProperties.Tie("minimum-sky-visibility", _sky, + &SGSky::get_minimum_sky_visibility, + &SGSky::set_minimum_sky_visibility); + // _tiedProperties.Tie("lightning-enable", &sgEnviro, // &SGEnviro::get_lightning_enable_state, // &SGEnviro::set_lightning_enable_state);