diff --git a/src/Airports/dynamics.cxx b/src/Airports/dynamics.cxx index 1b5b0bd41..d712b5be5 100644 --- a/src/Airports/dynamics.cxx +++ b/src/Airports/dynamics.cxx @@ -186,7 +186,6 @@ public: private: void populate() { -#if !defined(FG_TESTLIB) SGVec3d cartAirportPos = m_airport->cart(); FGAIManager* aiManager = globals->get_subsystem(); for (auto ai : aiManager->get_ai_list()) { @@ -199,7 +198,6 @@ private: m_cache.push_back(cart); } -#endif m_populated = true; } diff --git a/src/Environment/environment_mgr.cxx b/src/Environment/environment_mgr.cxx index 3fdb9db06..49ec2258e 100644 --- a/src/Environment/environment_mgr.cxx +++ b/src/Environment/environment_mgr.cxx @@ -27,12 +27,8 @@ #include #include -#ifdef FG_TESTLIB -#include -#else #include #include -#endif #include #include
@@ -52,7 +48,6 @@ #include "gravity.hxx" #include "magvarmanager.hxx" -#ifndef FG_TESTLIB class FG3DCloudsListener : public SGPropertyChangeListener { public: FG3DCloudsListener( FGClouds * fgClouds ); @@ -83,7 +78,6 @@ void FG3DCloudsListener::valueChanged( SGPropertyNode * node ) { _fgClouds->set_3dClouds( _enableNode->getBoolValue() ); } -#endif FGEnvironmentMgr::FGEnvironmentMgr () : _environment(new FGEnvironment()), @@ -92,17 +86,13 @@ FGEnvironmentMgr::FGEnvironmentMgr () : _3dCloudsEnableListener(nullptr), _sky(globals->get_renderer()->getSky()) { -#ifndef FG_TESTLIB fgClouds = new FGClouds; _3dCloudsEnableListener = new FG3DCloudsListener(fgClouds); -#endif set_subsystem("controller", Environment::LayerInterpolateController::createInstance( fgGetNode("/environment/config", true ) )); set_subsystem("precipitation", new FGPrecipitationMgr); -#ifndef FG_TESTLIB set_subsystem("realwx", Environment::RealWxController::createInstance( fgGetNode("/environment/realwx", true ) ), 1.0 ); set_subsystem("terrainsampler", Environment::TerrainSampler::createInstance( fgGetNode("/environment/terrain", true ) )); -#endif set_subsystem("ridgelift", new FGRidgeLift); set_subsystem("magvar", new FGMagVarManager); @@ -117,10 +107,8 @@ FGEnvironmentMgr::~FGEnvironmentMgr () remove_subsystem("controller"); remove_subsystem("magvar"); -#ifndef FG_TESTLIB delete fgClouds; delete _3dCloudsEnableListener; -#endif delete _environment; } @@ -129,9 +117,7 @@ SGSubsystem::InitStatus FGEnvironmentMgr::incrementalInit() InitStatus r = SGSubsystemGroup::incrementalInit(); if (r == INIT_DONE) { -#ifndef FG_TESTLIB fgClouds->Init(); -#endif globals->get_event_mgr()->addTask("updateClosestAirport", this, &FGEnvironmentMgr::updateClosestAirport, 30 ); } @@ -164,11 +150,9 @@ FGEnvironmentMgr::bind () _tiedProperties.Tie( "effective-visibility-m", _sky, &SGSky::get_visibility ); -#ifndef FG_TESTLIB _tiedProperties.Tie("rebuild-layers", fgClouds, &FGClouds::get_update_event, &FGClouds::set_update_event); -#endif // _tiedProperties.Tie("turbulence/use-cloud-turbulence", &sgEnviro, // &SGEnviro::get_turbulence_enable_state, // &SGEnviro::set_turbulence_enable_state); @@ -256,14 +240,12 @@ FGEnvironmentMgr::update (double dt) SGGeod aircraftPos(globals->get_aircraft_position()); _environment->set_elevation_ft( aircraftPos.getElevationFt() ); -#ifndef FG_TESTLIB simgear::Particles::setWindFrom( _environment->get_wind_from_heading_deg(), _environment->get_wind_speed_kt() ); if( _cloudLayersDirty ) { _cloudLayersDirty = false; fgClouds->set_update_event( fgClouds->get_update_event()+1 ); } -#endif fgSetDouble( "/environment/gravitational-acceleration-mps2", Environment::Gravity::instance()->getGravity(aircraftPos)); diff --git a/src/Environment/precipitation_mgr.hxx b/src/Environment/precipitation_mgr.hxx index 127ca2923..360ee3ff5 100644 --- a/src/Environment/precipitation_mgr.hxx +++ b/src/Environment/precipitation_mgr.hxx @@ -36,10 +36,8 @@ class FGPrecipitationMgr : public SGSubsystem { private: -#ifndef FG_TESTLIB osg::ref_ptr transform; osg::ref_ptr precipitation; -#endif float getPrecipitationAtAltitudeMax(void); simgear::TiedPropertyList _tiedProperties; diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index fadca00a8..441303f05 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -240,10 +240,8 @@ setFreeze (bool f) } } -#ifndef FG_TESTLIB // Pause the particle system simgear::Particles::setFrozen(f); -#endif } diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 6547777bf..75c730642 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -25,10 +25,8 @@ #include #include -#ifndef FG_TESTLIB #include #include -#endif #include #include @@ -54,7 +52,6 @@ #include #include -#ifndef FG_TESTLIB #include #include #include @@ -63,7 +60,6 @@ #include #include -#endif #include "globals.hxx" #include "locale.hxx" @@ -148,9 +144,7 @@ FGGlobals *globals = NULL; // Constructor FGGlobals::FGGlobals() : -#ifndef FG_TESTLIB renderer( new FGRenderer ), -#endif subsystem_mgr( new SGSubsystemMgr ), event_mgr( new SGEventMgr ), sim_time_sec( 0.0 ), @@ -201,7 +195,6 @@ FGGlobals::~FGGlobals() // stop OSG threading first, to avoid thread races while we tear down // scene-graph pieces -#ifndef FG_TESTLIB osg::ref_ptr vw(renderer->getViewer()); if (vw) { // https://code.google.com/p/flightgear-bugs/issues/detail?id=1291 @@ -210,11 +203,9 @@ FGGlobals::~FGGlobals() // GraphicsContext) vw->stopThreading(); } -#endif subsystem_mgr->shutdown(); subsystem_mgr->unbind(); -#ifndef FG_TESTLIB // don't cancel the pager until after shutdown, since AIModels (and // potentially others) can queue delete requests on the pager. if (vw && vw->getDatabasePager()) { @@ -230,14 +221,11 @@ FGGlobals::~FGGlobals() FGFontCache::shutdown(); fgCancelSnapShot(); -#endif delete subsystem_mgr; subsystem_mgr = NULL; // important so ::get_subsystem returns NULL -#ifndef FG_TESTLIB vw = nullptr; // don't delete the viewer until now set_matlib(NULL); -#endif delete time_params; delete channel_options_list; @@ -245,9 +233,7 @@ FGGlobals::~FGGlobals() delete channellist; simgear::PropertyObjectBase::setDefaultRoot(NULL); -#ifndef FG_TESTLIB simgear::SGModelLib::resetPropertyRoot(); -#endif delete locale; locale = NULL; @@ -520,14 +506,12 @@ FGGlobals::get_renderer () const void FGGlobals::set_renderer(FGRenderer *render) { - #ifndef FG_TESTLIB if (render == renderer) { return; } delete renderer; renderer = render; -#endif } SGSubsystemMgr * @@ -870,11 +854,7 @@ void FGGlobals::set_warp_delta( long int d ) FGScenery* FGGlobals::get_scenery () const { -#ifdef FG_TESTLIB - return nullptr; -#else return get_subsystem(); -#endif } FGViewMgr *FGGlobals::get_viewmgr() const @@ -890,9 +870,7 @@ flightgear::View* FGGlobals::get_current_view () const void FGGlobals::set_matlib( SGMaterialLib *m ) { -#ifndef FG_TESTLIB matlib = m; -#endif } FGControls *FGGlobals::get_controls() const diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index 877b0411e..843e835c6 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -118,10 +118,8 @@ private: // Time structure SGTime *time_params; -#ifndef FG_TESTLIB // Material properties library SGSharedPtr matlib; -#endif SGCommandMgr *commands; @@ -324,11 +322,7 @@ public: inline SGMaterialLib *get_matlib() const { - #ifdef FG_TESTLIB - return nullptr; - #else return matlib; - #endif } void set_matlib( SGMaterialLib *m ); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 13c3b0ade..41e563428 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -60,7 +60,7 @@ #include #include -#if defined(HAVE_QT) && !defined(FG_TESTLIB) +#if defined(HAVE_QT) #include #include #endif @@ -238,12 +238,10 @@ void fgSetDefaults () SGPropertyNode* v = globals->get_props()->getNode("/sim/version", true); v->setValueReadOnly("flightgear", FLIGHTGEAR_VERSION); v->setValueReadOnly("simgear", SG_STRINGIZE(SIMGEAR_VERSION)); -#ifndef FG_TESTLIB v->setValueReadOnly("openscenegraph", osgGetVersion()); #if OSG_VERSION_LESS_THAN(3,5,2) v->setValueReadOnly("openscenegraph-thread-safe-reference-counting", osg::Referenced::getThreadSafeReferenceCounting()); -#endif #endif v->setValueReadOnly("revision", REVISION); v->setValueReadOnly("build-number", HUDSON_BUILD_NUMBER); @@ -1036,14 +1034,12 @@ fgOptJpgHttpd( const char * arg ) static int fgOptHttpd( const char * arg ) { -#ifndef FG_TESTLIB // port may be any valid address:port notation // like 127.0.0.1:8080 // or just the port 8080 string port = simgear::strutils::strip(string(arg)); if( port.empty() ) return FG_OPTIONS_ERROR; fgSetString( string(flightgear::http::PROPERTY_ROOT).append("/options/listening-port").c_str(), port ); -#endif return FG_OPTIONS_OK; } @@ -2109,9 +2105,7 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath) } if (!p->shouldLoadDefaultConfig) { -#if !defined(FG_TESTLIB) setupRoot(argc, argv); -#endif return; } @@ -2750,9 +2744,7 @@ void Options::showVersion() const PathList scn = globals->get_fg_scenery(); cout << SGPath::join(scn, SGPath::pathListSep) << endl; cout << "SimGear version: " << SG_STRINGIZE(SIMGEAR_VERSION) << endl; -#ifndef FG_TESTLIB cout << "OSG version: " << osgGetVersion() << endl; -#endif cout << "PLIB version: " << PLIB_VERSION << endl; } @@ -2890,7 +2882,7 @@ void Options::setupRoot(int argc, char **argv) root = SGPath::fromLocal8Bit(envp); SG_LOG(SG_GENERAL, SG_INFO, "set from FG_ROOT env var: fg_root = " << root ); } else { -#if defined(HAVE_QT) && !defined(FG_TESTLIB) +#if defined(HAVE_QT) flightgear::initApp(argc, argv); root = SetupRootDialog::restoreUserSelectedRoot(); #endif @@ -2908,7 +2900,7 @@ void Options::setupRoot(int argc, char **argv) string base_version = fgBasePackageVersion(root); -#if defined(HAVE_QT) && !defined(FG_TESTLIB) +#if defined(HAVE_QT) // only compare major and minor version, not the patch level. const int versionComp = simgear::strutils::compare_versions(FLIGHTGEAR_VERSION, base_version, 2); diff --git a/src/Main/positioninit.cxx b/src/Main/positioninit.cxx index 3221ecd07..38e57c7a2 100644 --- a/src/Main/positioninit.cxx +++ b/src/Main/positioninit.cxx @@ -456,7 +456,6 @@ static bool fgSetPosFromNAV( const string& id, static InitPosResult setInitialPosFromCarrier( const string& carrier ) { -#if !defined(FG_TESTLIB) const auto initialPos = FGAICarrier::initialPositionForCarrier(carrier); if (initialPos.first) { // set these so scenery system has a vicinity to work with, and @@ -468,7 +467,6 @@ static InitPosResult setInitialPosFromCarrier( const string& carrier ) } SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate aircraft carrier = " << carrier ); -#endif return Failure; } @@ -476,7 +474,6 @@ static InitPosResult setInitialPosFromCarrier( const string& carrier ) static InitPosResult setFinalPosFromCarrier( const string& carrier, const string& posid ) { -#if !defined(FG_TESTLIB) SGSharedPtr carrierRef = FGAICarrier::findCarrierByNameOrPennant(carrier); if (!carrierRef) { SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate aircraft carrier = " @@ -540,7 +537,6 @@ static InitPosResult setFinalPosFromCarrier( const string& carrier, const string ///////// return ExactPosition; } -#endif SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate aircraft carrier = " << carrier ); return Failure; } diff --git a/src/Scripting/NasalPositioned.cxx b/src/Scripting/NasalPositioned.cxx index 21374c528..ef22cb27b 100644 --- a/src/Scripting/NasalPositioned.cxx +++ b/src/Scripting/NasalPositioned.cxx @@ -1262,7 +1262,6 @@ static naRef f_geodinfo(naContext c, naRef me, int argc, naRef* args) naRef vec = naNewVector(c); naVec_append(vec, naNum(elev)); -#ifndef FG_TESTLIB naRef matdata = naNil(); const SGMaterial *mat = dynamic_cast(material); @@ -1281,7 +1280,6 @@ static naRef f_geodinfo(naContext c, naRef me, int argc, naRef* args) HASHSET("light_coverage", 14, naNum(mat->get_light_coverage())); } naVec_append(vec, matdata); -#endif return vec; #undef HASHSET } diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 741d76a4f..c97fbacf5 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -913,10 +913,8 @@ void FGNasalSys::init() initNasalPositioned(_globals, _context); initNasalPositioned_cppbind(_globals, _context); initNasalAircraft(_globals, _context); -#ifndef FG_TESTLIB NasalClipboard::init(this); initNasalCanvas(_globals, _context); -#endif initNasalCondition(_globals, _context); initNasalHTTP(_globals, _context); initNasalSGPath(_globals, _context); @@ -1016,17 +1014,14 @@ naRef FGNasalSys::wrappedPropsNode(SGPropertyNode* aProps) void FGNasalSys::update(double) { -#ifndef FG_TESTLIB if( NasalClipboard::getInstance() ) NasalClipboard::getInstance()->update(); -#endif if(!_dead_listener.empty()) { vector::iterator it, end = _dead_listener.end(); for(it = _dead_listener.begin(); it != end; ++it) delete *it; _dead_listener.clear(); } -#ifndef FG_TESTLIB if (!_loadList.empty()) { if( _delay_load ) @@ -1042,7 +1037,6 @@ void FGNasalSys::update(double) // (only unload one per update loop to avoid excessive lags) _unloadList.pop()->unload(); } -#endif // Destroy all queued ghosts nasal::ghostProcessDestroyList(); @@ -1478,18 +1472,14 @@ naRef FGNasalSys::removeListener(naContext c, int argc, naRef* args) void FGNasalSys::registerToLoad(FGNasalModelData *data) { -#ifndef FG_TESTLIB if( _loadList.empty() ) _delay_load = true; _loadList.push(data); -#endif } void FGNasalSys::registerToUnload(FGNasalModelData *data) { -#ifndef FG_TESTLIB _unloadList.push(data); -#endif } void FGNasalSys::addCommand(naRef func, const std::string& name) diff --git a/src/Scripting/NasalSys.hxx b/src/Scripting/NasalSys.hxx index c5bb7b9b7..502fd9dbc 100644 --- a/src/Scripting/NasalSys.hxx +++ b/src/Scripting/NasalSys.hxx @@ -160,10 +160,8 @@ private: //friend class FGNasalScript; friend class FGNasalListener; friend class FGNasalModuleListener; -#ifndef FG_TESTLIB SGLockedQueue > _loadList; SGLockedQueue > _unloadList; -#endif // Delay removing items of the _loadList to ensure the are already attached // to the scene graph (eg. enables to retrieve world position in load // callback). diff --git a/src/Viewer/view.cxx b/src/Viewer/view.cxx index ae3d3419c..7cb3a1f6b 100644 --- a/src/Viewer/view.cxx +++ b/src/Viewer/view.cxx @@ -1078,11 +1078,7 @@ double View::getOrientation_z() const{ double View::get_aspect_ratio() const { -#ifdef FG_TESTLIB - return 4.0 / 3.0; -#else return flightgear::CameraGroup::getDefault()->getMasterAspectRatio(); -#endif } double View::getLon_deg() const diff --git a/src/Viewer/viewmgr.cxx b/src/Viewer/viewmgr.cxx index 6e3c6bb0f..67a2e53cc 100644 --- a/src/Viewer/viewmgr.cxx +++ b/src/Viewer/viewmgr.cxx @@ -137,15 +137,12 @@ FGViewMgr::update (double dt) // Update the current view currentView->update(dt); -#ifndef FG_TESTLIB - // update the camera now osg::ref_ptr cameraGroup = flightgear::CameraGroup::getDefault(); cameraGroup->update(toOsg(currentView->getViewPosition()), toOsg(currentView->getViewOrientation())); cameraGroup->setCameraParameters(currentView->get_v_fov(), cameraGroup->getMasterAspectRatio()); -#endif } void FGViewMgr::clear() diff --git a/test_suite/FGTestApi/globals.cxx b/test_suite/FGTestApi/globals.cxx index 8e47f2b6a..21f759f3b 100644 --- a/test_suite/FGTestApi/globals.cxx +++ b/test_suite/FGTestApi/globals.cxx @@ -4,7 +4,7 @@ #include "globals.hxx" -#if defined(HAVE_QT) && !defined(FG_TESTLIB) +#if defined(HAVE_QT) #include #endif @@ -57,7 +57,7 @@ void shutdownTestGlobals() { // The QApplication instance must be destroyed before exit() begins, see // (otherwise, segfault). -#if defined(HAVE_QT) && !defined(FG_TESTLIB) +#if defined(HAVE_QT) flightgear::shutdownQtApp(); #endif