From 58a2e092a159ae89c15896a494e7e29c02e01e27 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Sat, 25 Jun 2011 14:30:54 +0200 Subject: [PATCH 01/36] Update 3rdparty files for win32/x64 to OSG 3.0.0-rc5 --- docs-mini/README.MSVC | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-mini/README.MSVC b/docs-mini/README.MSVC index 68186886d..ef90b36a6 100644 --- a/docs-mini/README.MSVC +++ b/docs-mini/README.MSVC @@ -2,10 +2,10 @@ Use FlightGear.sln to compile fgfs executable for Win32 or x64 architectures wit Previous versions of Visual Studio are not officially supported anymore. Precompiled librairies and headers for compiling Win32 executables with VS2008 : -ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-win32-VS90-3rdParty+OSG-20110618.zip +ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-win32-VS90-3rdParty+OSG-20110625.zip Precompiled librairies and headers for compiling x64 executables with VS2008 : -ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-x64-VS90-3rdParty+OSG-20110618.zip +ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-x64-VS90-3rdParty+OSG-20110625.zip The VS2008 / v9.0 project files assume the directory layout below : From b82b4fca7db36a3d307f5db59f230624be041141 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Sat, 2 Jul 2011 19:07:59 +0200 Subject: [PATCH 02/36] Trying to support new osg file formats by providing required plug-ins --- package/Win-NSIS/flightgear-nightly.nsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package/Win-NSIS/flightgear-nightly.nsi b/package/Win-NSIS/flightgear-nightly.nsi index 9e2d27b93..856d861ba 100644 --- a/package/Win-NSIS/flightgear-nightly.nsi +++ b/package/Win-NSIS/flightgear-nightly.nsi @@ -102,6 +102,16 @@ Section "" ;No components page, name is not important File ${OSGPluginsDir}\osgdb_png.dll File ${OSGPluginsDir}\osgdb_dds.dll File ${OSGPluginsDir}\osgdb_txf.dll + File ${OSGPluginsDir}\osgdb_serializers_osg.dll + File ${OSGPluginsDir}\osgdb_serializers_osganimation.dll + File ${OSGPluginsDir}\osgdb_serializers_osgfx.dll + File ${OSGPluginsDir}\osgdb_serializers_osgmanipulator.dll + File ${OSGPluginsDir}\osgdb_serializers_osgparticle.dll + File ${OSGPluginsDir}\osgdb_serializers_osgshadow.dll + File ${OSGPluginsDir}\osgdb_serializers_osgsim.dll + File ${OSGPluginsDir}\osgdb_serializers_osgterrain.dll + File ${OSGPluginsDir}\osgdb_serializers_osgtext.dll + File ${OSGPluginsDir}\osgdb_serializers_osgvolume.dll File ${OSGPluginsDir}\osgdb_deprecated_osg.dll File ${OSGPluginsDir}\osgdb_deprecated_osgparticle.dll From 979ad55c61b9bbacafeb59bbff8fe1de0c035020 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Sun, 3 Jul 2011 08:54:05 +0200 Subject: [PATCH 03/36] Update 3rdparty files for win32/x64 to OSG 3.0.0 --- docs-mini/README.MSVC | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs-mini/README.MSVC b/docs-mini/README.MSVC index ef90b36a6..e1b41ea08 100644 --- a/docs-mini/README.MSVC +++ b/docs-mini/README.MSVC @@ -2,10 +2,10 @@ Use FlightGear.sln to compile fgfs executable for Win32 or x64 architectures wit Previous versions of Visual Studio are not officially supported anymore. Precompiled librairies and headers for compiling Win32 executables with VS2008 : -ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-win32-VS90-3rdParty+OSG-20110625.zip +ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-win32-VS90-3rdParty+OSG-20110703.zip Precompiled librairies and headers for compiling x64 executables with VS2008 : -ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-x64-VS90-3rdParty+OSG-20110625.zip +ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-x64-VS90-3rdParty+OSG-20110703.zip The VS2008 / v9.0 project files assume the directory layout below : From 4fd1e219a44f7fe1913a76daf90c393bba9bfa73 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sun, 3 Jul 2011 13:06:41 +0200 Subject: [PATCH 04/36] #348 related: More places where missing files were not reported properly Whenever resolving a (relative) path to an absolute path with 'resolve_maybe_aircraft_path', check if the result is empty and report original (relative) path as missing. Otherwise no or a meaningless message is issued ("File '' not found."). --- src/Autopilot/autopilotgroup.cxx | 34 +++++++++++++++++++------------- src/Instrumentation/HUD/HUD.cxx | 7 ++++++- src/Main/fg_commands.cxx | 10 +++++++++- src/Main/splash.cxx | 19 +++++++++++++----- src/Scripting/NasalSys.cxx | 7 ++++++- 5 files changed, 55 insertions(+), 22 deletions(-) diff --git a/src/Autopilot/autopilotgroup.cxx b/src/Autopilot/autopilotgroup.cxx index 347a39e0e..cf06bb4b4 100644 --- a/src/Autopilot/autopilotgroup.cxx +++ b/src/Autopilot/autopilotgroup.cxx @@ -119,23 +119,29 @@ void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode, c } SGPath config = globals->resolve_maybe_aircraft_path(pathNode->getStringValue()); + if (config.isNull()) + { + SG_LOG( SG_ALL, SG_ALERT, "Cannot find property-rule configuration file '" << pathNode->getStringValue() << "'." ); + } + else + { + SG_LOG( SG_ALL, SG_INFO, "Reading property-rule configuration from " << config.str() ); - SG_LOG( SG_ALL, SG_INFO, "Reading property-rule configuration from " << config.str() ); + try { + SGPropertyNode_ptr root = new SGPropertyNode(); + readProperties( config.str(), root ); - try { - SGPropertyNode_ptr root = new SGPropertyNode(); - readProperties( config.str(), root ); + SG_LOG( SG_AUTOPILOT, SG_INFO, "adding property-rule subsystem " << apName ); + FGXMLAutopilot::Autopilot * ap = new FGXMLAutopilot::Autopilot( autopilotNodes[i], root ); + ap->set_name( apName ); + set_subsystem( apName, ap ); + _autopilotNames.push_back( apName ); - SG_LOG( SG_AUTOPILOT, SG_INFO, "adding property-rule subsystem " << apName ); - FGXMLAutopilot::Autopilot * ap = new FGXMLAutopilot::Autopilot( autopilotNodes[i], root ); - ap->set_name( apName ); - set_subsystem( apName, ap ); - _autopilotNames.push_back( apName ); - - } catch (const sg_exception& e) { - SG_LOG( SG_AUTOPILOT, SG_ALERT, "Failed to load property-rule configuration: " - << config.str() << ":" << e.getMessage() ); - continue; + } catch (const sg_exception& e) { + SG_LOG( SG_AUTOPILOT, SG_ALERT, "Failed to load property-rule configuration: " + << config.str() << ":" << e.getMessage() ); + continue; + } } } } diff --git a/src/Instrumentation/HUD/HUD.cxx b/src/Instrumentation/HUD/HUD.cxx index eace97cc0..6d9e0bd90 100644 --- a/src/Instrumentation/HUD/HUD.cxx +++ b/src/Instrumentation/HUD/HUD.cxx @@ -346,6 +346,11 @@ int HUD::load(const char *file, float x, float y, int level, const string& inden const int MAXNEST = 10; SGPath path(globals->resolve_maybe_aircraft_path(file)); + if (path.isNull()) + { + SG_LOG(SG_INPUT, SG_ALERT, "HUD: Cannot find configuration file '" << file << "'."); + return 0x2; + } if (!level) { SG_LOG(SG_INPUT, TREE, endl << "load " << file); @@ -362,7 +367,7 @@ int HUD::load(const char *file, float x, float y, int level, const string& inden int ret = 0; ifstream input(path.c_str()); if (!input.good()) { - SG_LOG(SG_INPUT, SG_ALERT, "HUD: Cannot read configuration from " << path.str()); + SG_LOG(SG_INPUT, SG_ALERT, "HUD: Cannot read configuration from '" << path.c_str() << "'"); return 0x4; } diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index f9933243d..7711f6b4f 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -1229,7 +1229,15 @@ do_load_xml_to_proptree(const SGPropertyNode * arg) std::string icao = arg->getStringValue("icao"); if (icao.empty()) { if (file.isRelative()) { - file = globals->resolve_maybe_aircraft_path(file.str()); + SGPath absPath = globals->resolve_maybe_aircraft_path(file.str()); + if (!absPath.isNull()) + file = absPath; + else + { + SG_LOG(SG_IO, SG_ALERT, "loadxml: Cannot find XML property file '" + << file.str() << "'."); + return false; + } } } else { if (!XMLLoader::findAirportData(icao, file.str(), file)) { diff --git a/src/Main/splash.cxx b/src/Main/splash.cxx index 36cc60326..a21064cab 100644 --- a/src/Main/splash.cxx +++ b/src/Main/splash.cxx @@ -187,8 +187,19 @@ static osg::Node* fgCreateSplashCamera() fgSetString("/sim/startup/program-name", namestring); delete[] namestring; - SGPath tpath( globals->get_fg_root() ); - if (splash_texture == NULL || !strcmp(splash_texture, "")) { + SGPath tpath; + if (splash_texture && strcmp(splash_texture, "")) { + tpath = globals->resolve_maybe_aircraft_path(splash_texture); + if (tpath.isNull()) + { + SG_LOG( SG_GENERAL, SG_ALERT, "Cannot find splash screen file '" << splash_texture + << "'. Using default." ); + } + } + + if (tpath.isNull()) { + // no splash screen specified - select random image + tpath = globals->get_fg_root(); // load in the texture data int num = (int)(sg_random() * 5.0 + 1.0); char num_str[5]; @@ -197,10 +208,8 @@ static osg::Node* fgCreateSplashCamera() tpath.append( "Textures/Splash" ); tpath.concat( num_str ); tpath.concat( ".png" ); - } else { - tpath = globals->resolve_maybe_aircraft_path(splash_texture); } - + osg::Texture2D* splashTexture = new osg::Texture2D; splashTexture->setImage(osgDB::readImageFile(tpath.c_str())); diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 9542c5d55..e2bc88619 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -880,8 +880,13 @@ void FGNasalSys::loadPropertyScripts(SGPropertyNode* n) if (!p.isAbsolute() || !p.exists()) { p = globals->resolve_maybe_aircraft_path(file); + if (p.isNull()) + { + SG_LOG(SG_NASAL, SG_ALERT, "Cannot find Nasal script '" << + file << "' for module '" << module << "'."); + } } - ok &= loadModule(p, module); + ok &= p.isNull() ? false : loadModule(p, module); j++; } From 69905cc45b0e52d47886736cbfba095f54cecb4b Mon Sep 17 00:00:00 2001 From: Anders Gidenstam Date: Sun, 3 Jul 2011 22:05:57 +0200 Subject: [PATCH 05/36] Fixed faulty frame transformation of moment of inertia. Thanks to Jon for finding the problem. --- src/FDM/JSBSim/models/FGBuoyantForces.cpp | 15 ++------ src/FDM/JSBSim/models/FGBuoyantForces.h | 29 +++++++------- src/FDM/JSBSim/models/FGGasCell.cpp | 24 +++++------- src/FDM/JSBSim/models/FGGasCell.h | 47 ++++++++++++----------- 4 files changed, 52 insertions(+), 63 deletions(-) diff --git a/src/FDM/JSBSim/models/FGBuoyantForces.cpp b/src/FDM/JSBSim/models/FGBuoyantForces.cpp index 96fd81d67..a1824e7a0 100644 --- a/src/FDM/JSBSim/models/FGBuoyantForces.cpp +++ b/src/FDM/JSBSim/models/FGBuoyantForces.cpp @@ -5,7 +5,7 @@ Date started: 01/21/08 Purpose: Encapsulates the buoyant forces - ------------- Copyright (C) 2008 - 2010 Anders Gidenstam ------------- + ------------- Copyright (C) 2008 - 2011 Anders Gidenstam ------------- ------------- Copyright (C) 2008 Jon S. Berndt (jon@jsbsim.org) ------------- This program is free software; you can redistribute it and/or modify it under @@ -45,7 +45,7 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.17 2011/05/20 03:18:36 jberndt Exp $"; +static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.19 2011/07/01 21:22:25 andgi Exp $"; static const char *IdHdr = ID_BUOYANTFORCES; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -179,16 +179,7 @@ const FGMatrix33& FGBuoyantForces::GetGasMassInertia(void) gasCellJ = FGMatrix33(); for (unsigned int i=0; i < size; i++) { - FGColumnVector3 v = FDMExec->GetMassBalance()->StructuralToBody( Cells[i]->GetXYZ() ); - // Body basis is in FT. - const double mass = Cells[i]->GetMass(); - - // FIXME: Verify that this is the correct way to change between the - // coordinate frames. - gasCellJ += Cells[i]->GetInertia() + - FGMatrix33( 0, - mass*v(1)*v(2), - mass*v(1)*v(3), - - mass*v(2)*v(1), 0, - mass*v(2)*v(3), - - mass*v(3)*v(1), - mass*v(3)*v(2), 0 ); + gasCellJ += Cells[i]->GetInertia(); } return gasCellJ; diff --git a/src/FDM/JSBSim/models/FGBuoyantForces.h b/src/FDM/JSBSim/models/FGBuoyantForces.h index e3baab137..ac712e242 100644 --- a/src/FDM/JSBSim/models/FGBuoyantForces.h +++ b/src/FDM/JSBSim/models/FGBuoyantForces.h @@ -4,7 +4,7 @@ Author: Anders Gidenstam, Jon S. Berndt Date started: 01/21/08 - ------------- Copyright (C) 2008 - 2010 Anders Gidenstam ------------- + ------------- Copyright (C) 2008 - 2011 Anders Gidenstam ------------- ------------- Copyright (C) 2008 Jon S. Berndt (jon@jsbsim.org) ------------- This program is free software; you can redistribute it and/or modify it under @@ -51,7 +51,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_BUOYANTFORCES "$Id: FGBuoyantForces.h,v 1.12 2011/05/20 03:18:36 jberndt Exp $" +#define ID_BUOYANTFORCES "$Id: FGBuoyantForces.h,v 1.13 2011/07/01 21:22:25 andgi Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -96,7 +96,7 @@ CLASS DOCUMENTATION See FGGasCell for the full configuration file format for gas cells. @author Anders Gidenstam, Jon S. Berndt - @version $Id: FGBuoyantForces.h,v 1.12 2011/05/20 03:18:36 jberndt Exp $ + @version $Id: FGBuoyantForces.h,v 1.13 2011/07/01 21:22:25 andgi Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -132,19 +132,19 @@ public: bool Load(Element* element); /** Gets the total Buoyant force vector. - @return a force vector. */ + @return a force vector in lbs. */ const FGColumnVector3& GetForces(void) const {return vTotalForces;} /** Gets a component of the total Buoyant force vector. - @return a component of the force vector. */ + @return a component of the force vector in lbs. */ double GetForces(int idx) const {return vTotalForces(idx);} /** Gets the total Buoyancy moment vector. - @return a moment vector. */ + @return a moment vector in the body frame in lbs ft. */ const FGColumnVector3& GetMoments(void) const {return vTotalMoments;} /** Gets a component of the total Buoyancy moment vector. - @return a component of the moment vector. */ + @return a component of the moment vector in the body frame in lbs ft. */ double GetMoments(int idx) const {return vTotalMoments(idx);} /** Gets the total gas mass. The gas mass is part of the aircraft's @@ -153,11 +153,12 @@ public: double GetGasMass(void); /** Gets the total moment from the gas mass. - @return a moment vector. */ + @return a moment vector in the structural frame in lbs in. */ const FGColumnVector3& GetGasMassMoment(void); - /** Gets the total moments of inertia for the gas mass. - @return . */ + /** Gets the total moments of inertia for the gas mass in the body frame. + @return moments of inertia matrix in the body frame + in slug ft2. */ const FGMatrix33& GetGasMassInertia(void); /** Gets the strings for the current set of gas cells. @@ -174,13 +175,13 @@ public: private: vector Cells; // Buoyant forces and moments. Excluding the gas weight. - FGColumnVector3 vTotalForces; - FGColumnVector3 vTotalMoments; + FGColumnVector3 vTotalForces; // [lbs] + FGColumnVector3 vTotalMoments; // [lbs ft] // Gas mass related masses, inertias and moments. - FGMatrix33 gasCellJ; + FGMatrix33 gasCellJ; // [slug ft^2] FGColumnVector3 vGasCellXYZ; - FGColumnVector3 vXYZgasCell_arm; + FGColumnVector3 vXYZgasCell_arm; // [lbs in] bool NoneDefined; diff --git a/src/FDM/JSBSim/models/FGGasCell.cpp b/src/FDM/JSBSim/models/FGGasCell.cpp index bdab72172..742288cd6 100644 --- a/src/FDM/JSBSim/models/FGGasCell.cpp +++ b/src/FDM/JSBSim/models/FGGasCell.cpp @@ -4,7 +4,7 @@ Author: Anders Gidenstam Date started: 01/21/2006 - ----- Copyright (C) 2006 - 2008 Anders Gidenstam (anders(at)gidenstam.org) -- + ----- Copyright (C) 2006 - 2011 Anders Gidenstam (anders(at)gidenstam.org) -- This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -53,7 +53,7 @@ using std::max; namespace JSBSim { -static const char *IdSrc = "$Id: FGGasCell.cpp,v 1.13 2010/12/29 22:39:25 andgi Exp $"; +static const char *IdSrc = "$Id: FGGasCell.cpp,v 1.14 2011/07/01 21:22:25 andgi Exp $"; static const char *IdHdr = ID_GASCELL; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -405,6 +405,9 @@ void FGGasCell::Calculate(double dt) gasCellJ(2,2) = Iyy; gasCellJ(3,3) = Izz; Mass = mass; + // Transform the moments of inertia to the body frame. + gasCellJ += MassBalance->GetPointmassInertia(Mass, GetXYZ()); + gasCellM.InitMatrix(); gasCellM(eX) += GetXYZ(eX) * Mass*slugtolb; @@ -415,12 +418,10 @@ void FGGasCell::Calculate(double dt) if (no_ballonets > 0) { // Add the mass, moment and inertia of any ballonets. - const FGColumnVector3 p = MassBalance->StructuralToBody( GetXYZ() ); - for (i = 0; i < no_ballonets; i++) { Mass += Ballonet[i]->GetMass(); - // Add ballonet moments. + // Add ballonet moments due to mass (in the structural frame). gasCellM(eX) += Ballonet[i]->GetXYZ(eX) * Ballonet[i]->GetMass()*slugtolb; gasCellM(eY) += @@ -428,15 +429,7 @@ void FGGasCell::Calculate(double dt) gasCellM(eZ) += Ballonet[i]->GetXYZ(eZ) * Ballonet[i]->GetMass()*slugtolb; - // Moments of inertia must be converted to the gas cell frame here. - FGColumnVector3 v = - MassBalance->StructuralToBody( Ballonet[i]->GetXYZ() ) - p; - // Body basis is in FT. - const double mass = Ballonet[i]->GetMass(); - gasCellJ += Ballonet[i]->GetInertia() + - FGMatrix33( 0, - mass*v(1)*v(2), - mass*v(1)*v(3), - - mass*v(2)*v(1), 0, - mass*v(2)*v(3), - - mass*v(3)*v(1), - mass*v(3)*v(2), 0 ); + gasCellJ += Ballonet[i]->GetInertia(); } } } @@ -525,6 +518,7 @@ FGBallonet::FGBallonet(FGFDMExec* exec, Element* el, int num, FGGasCell* parent) Atmosphere = exec->GetAtmosphere(); PropertyManager = exec->GetPropertyManager(); Inertial = exec->GetInertial(); + MassBalance = exec->GetMassBalance(); ballonetJ = FGMatrix33(); @@ -791,6 +785,8 @@ void FGBallonet::Calculate(double dt) ballonetJ(1,1) = Ixx; ballonetJ(2,2) = Iyy; ballonetJ(3,3) = Izz; + // Transform the moments of inertia to the body frame. + ballonetJ += MassBalance->GetPointmassInertia(GetMass(), GetXYZ()); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/FGGasCell.h b/src/FDM/JSBSim/models/FGGasCell.h index de34fb670..abe73ac5b 100644 --- a/src/FDM/JSBSim/models/FGGasCell.h +++ b/src/FDM/JSBSim/models/FGGasCell.h @@ -4,7 +4,7 @@ Author: Anders Gidenstam Date started: 01/21/2006 - ----- Copyright (C) 2006 - 2008 Anders Gidenstam (anders(at)gidenstam.org) -- + ----- Copyright (C) 2006 - 2011 Anders Gidenstam (anders(at)gidenstam.org) -- This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -50,7 +50,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_GASCELL "$Id: FGGasCell.h,v 1.10 2009/10/24 22:59:30 jberndt Exp $" +#define ID_GASCELL "$Id: FGGasCell.h,v 1.11 2011/07/01 21:22:25 andgi Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -189,12 +189,12 @@ public: /** Get the center of gravity location of the gas cell (including any ballonets) - @return CoG location in the structural frame. */ + @return CoG location in the structural frame in inches. */ const FGColumnVector3& GetXYZ(void) const {return vXYZ;} /** Get the center of gravity location of the gas cell (including any ballonets) - @return CoG location in the structural frame. */ + @return CoG location in the structural frame in inches. */ double GetXYZ(int idx) const {return vXYZ(idx);} /** Get the current mass of the gas cell (including any ballonets) @@ -202,7 +202,7 @@ public: double GetMass(void) const {return Mass;} /** Get the moments of inertia of the gas cell (including any ballonets) - @return moments of inertia matrix relative the gas cell location + @return moments of inertia matrix in the body frame in slug ft2. */ const FGMatrix33& GetInertia(void) const {return gasCellJ;} @@ -210,7 +210,7 @@ public: Note that the buoyancy of the gas cell is handled separately by the FGForce part and not included here. - @return moment vector in lbs ft. */ + @return moment vector in the structural frame in lbs in. */ const FGColumnVector3& GetMassMoment(void) const {return gasCellM;} /** Get the current gas temperature inside the gas cell @@ -229,8 +229,8 @@ private: std::string type; int CellNum; // Structural constants - double MaxVolume; // [ft�] - double MaxOverpressure; // [lbs/ft�] + double MaxVolume; // [ft^2] + double MaxOverpressure; // [lbs/ft^2] FGColumnVector3 vXYZ; // [in] double Xradius, Yradius, Zradius; // [ft] double Xwidth, Ywidth, Zwidth; // [ft] @@ -240,17 +240,17 @@ private: typedef vector BallonetArray; BallonetArray Ballonet; // Variables - double Pressure; // [lbs/ft�] + double Pressure; // [lbs/ft^2] double Contents; // [mol] - double Volume; // [ft�] - double dVolumeIdeal; // [ft�] + double Volume; // [ft^2] + double dVolumeIdeal; // [ft^2] double Temperature; // [Rankine] double Buoyancy; // [lbs] Note: Gross lift. // Does not include the weight of the gas itself. double ValveOpen; // 0 <= ValveOpen <= 1 (or higher). double Mass; // [slug] - FGMatrix33 gasCellJ; // [slug foot�] - FGColumnVector3 gasCellM; // [lbs ft] + FGMatrix33 gasCellJ; // [slug foot^2] + FGColumnVector3 gasCellM; // [lbs in] FGAuxiliary* Auxiliary; FGAtmosphere* Atmosphere; @@ -295,7 +295,6 @@ private: //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /** Models a ballonet inside a gas cell. - Models a ballonet inside a gas cell. Not intended to be used outside FGGasCell. See FGGasCell for the configuration file format. @author Anders Gidenstam @@ -312,10 +311,10 @@ public: /** Get the center of gravity location of the ballonet - @return CoG location in the structural frame. */ + @return CoG location in the structural frame in inches. */ const FGColumnVector3& GetXYZ(void) const {return vXYZ;} /** Get the center of gravity location of the ballonet - @return CoG location in the structural frame. */ + @return CoG location in the structural frame in inches. */ double GetXYZ(int idx) const {return vXYZ(idx);} /** Get the current mass of the ballonets @@ -323,7 +322,8 @@ public: double GetMass(void) const {return Contents * M_air;} /** Get the moments of inertia of the ballonet - @return moments of inertia matrix in slug ft2. */ + @return moments of inertia matrix in the body frame in + slug ft2. */ const FGMatrix33& GetInertia(void) const {return ballonetJ;} /** Get the current volume of the ballonet @@ -336,8 +336,8 @@ public: private: int CellNum; // Structural constants - double MaxVolume; // [ft�] - double MaxOverpressure; // [lbs/ft�] + double MaxVolume; // [ft^2] + double MaxOverpressure; // [lbs/ft^2] FGColumnVector3 vXYZ; // [in] double Xradius, Yradius, Zradius; // [ft] double Xwidth, Ywidth, Zwidth; // [ft] @@ -347,19 +347,20 @@ private: FGFunction* BlowerInput; // [ft^3 / sec] FGGasCell* Parent; // Variables - double Pressure; // [lbs/ft�] + double Pressure; // [lbs/ft^2] double Contents; // [mol] - double Volume; // [ft�] - double dVolumeIdeal; // [ft�] + double Volume; // [ft^2] + double dVolumeIdeal; // [ft^2] double dU; // [lbs ft / sec] double Temperature; // [Rankine] double ValveOpen; // 0 <= ValveOpen <= 1 (or higher). - FGMatrix33 ballonetJ; // [slug foot�] + FGMatrix33 ballonetJ; // [slug foot^2] FGAuxiliary* Auxiliary; FGAtmosphere* Atmosphere; FGPropertyManager* PropertyManager; FGInertial* Inertial; + FGMassBalance* MassBalance; void Debug(int from); /* Constants. */ From d45bfbf2256cbd5c85582a6100a72dbaaf77b21f Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Tue, 5 Jul 2011 17:33:11 +0200 Subject: [PATCH 06/36] Fix #220, Ctrl-U no longer working for YASim Set model-state's position from properties so it can be manipulated from the property tree. --- src/FDM/YASim/YASim.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/FDM/YASim/YASim.cxx b/src/FDM/YASim/YASim.cxx index 9635e7294..95261df55 100644 --- a/src/FDM/YASim/YASim.cxx +++ b/src/FDM/YASim/YASim.cxx @@ -259,6 +259,11 @@ void YASim::copyToYASim(bool copyState) // position sgGeodToCart(lat, lon, alt, s.pos); + { + // allow setting of /position/[lat|long|alti]tude + double * dp = &model->getState()->pos[0]; + dp[0] = s.pos[0]; dp[1] = s.pos[1]; dp[2] = s.pos[2]; + } // orientation Glue::euler2orient(roll, pitch, hdg, s.orient); From b839e8c3acff78eb2933e7fc0a9c9cc6334320da Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Wed, 6 Jul 2011 22:33:19 +0200 Subject: [PATCH 07/36] #367: raise log level for some routemanager error messages When flightplans cannot be loaded (i.e. --flight-plan command-line option fails), make sure the message is visible to the user with default log level. --- src/Autopilot/route_mgr.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index 044c624c8..bb9327483 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -380,7 +380,7 @@ void FGRouteMgr::postinit() { SGPath path(_pathNode->getStringValue()); if (path.exists()) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "loading flight-plan from:" << path.str()); + SG_LOG(SG_AUTOPILOT, SG_INFO, "loading flight-plan from: " << path.str()); loadRoute(path); } @@ -1303,7 +1303,7 @@ bool FGRouteMgr::saveRoute(const SGPath& path) writeProperties(path.str(), d, true /* write-all */); return true; } catch (sg_exception& e) { - SG_LOG(SG_IO, SG_WARN, "failed to save flight-plan:" << e.getMessage()); + SG_LOG(SG_IO, SG_ALERT, "Failed to save flight-plan '" << path.str() << "'. " << e.getMessage()); return false; } } @@ -1335,8 +1335,8 @@ bool FGRouteMgr::loadRoute(const SGPath& path) } return true; } catch (sg_exception& e) { - SG_LOG(SG_IO, SG_WARN, "failed to load flight-plan (from '" << e.getOrigin() - << "'):" << e.getMessage()); + SG_LOG(SG_IO, SG_ALERT, "Failed to load flight-plan '" << e.getOrigin() + << "'. " << e.getMessage()); return false; } } @@ -1478,7 +1478,7 @@ bool FGRouteMgr::loadPlainTextRoute(const SGPath& path) WayptRef w = waypointFromString(line); if (!w) { - throw sg_io_exception("failed to create waypoint from line:" + line); + throw sg_io_exception("Failed to create waypoint from line '" + line + "'."); } wpts.push_back(w); @@ -1487,7 +1487,7 @@ bool FGRouteMgr::loadPlainTextRoute(const SGPath& path) _route = wpts; return true; } catch (sg_exception& e) { - SG_LOG(SG_IO, SG_WARN, "failed to load route from:" << path.str() << ":" << e.getMessage()); + SG_LOG(SG_IO, SG_ALERT, "Failed to load route from: '" << path.str() << "'. " << e.getMessage()); return false; } } From eb3f135985612d6fb374edb04c92ad087b6d8dad Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Thu, 7 Jul 2011 08:44:09 +0200 Subject: [PATCH 08/36] #367: Add visible error messages when flight plan file isn't found/readable --- src/Autopilot/route_mgr.cxx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index bb9327483..94ec9980e 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -379,7 +379,7 @@ void FGRouteMgr::init() { void FGRouteMgr::postinit() { SGPath path(_pathNode->getStringValue()); - if (path.exists()) { + if (!path.isNull()) { SG_LOG(SG_AUTOPILOT, SG_INFO, "loading flight-plan from: " << path.str()); loadRoute(path); } @@ -1310,6 +1310,13 @@ bool FGRouteMgr::saveRoute(const SGPath& path) bool FGRouteMgr::loadRoute(const SGPath& path) { + if (!path.exists()) + { + SG_LOG(SG_IO, SG_ALERT, "Failed to load flight-plan '" << path.str() + << "'. The file does not exist."); + return false; + } + // deactivate route first active->setBoolValue(false); @@ -1456,12 +1463,12 @@ WayptRef FGRouteMgr::parseVersion1XMLWaypt(SGPropertyNode* aWP) bool FGRouteMgr::loadPlainTextRoute(const SGPath& path) { - sg_gzifstream in(path.str().c_str()); - if (!in.is_open()) { - return false; - } - try { + sg_gzifstream in(path.str().c_str()); + if (!in.is_open()) { + throw sg_io_exception("Cannot open file for reading."); + } + WayptVec wpts; while (!in.eof()) { string line; From 32159c6bcef4c47a228bca87c81d01fa72c17403 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Thu, 7 Jul 2011 18:40:44 +0200 Subject: [PATCH 09/36] Make the 32'th joystick button work. --- src/Input/FGJoystickInput.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Input/FGJoystickInput.cxx b/src/Input/FGJoystickInput.cxx index 506de36bb..3f490f5cb 100644 --- a/src/Input/FGJoystickInput.cxx +++ b/src/Input/FGJoystickInput.cxx @@ -329,7 +329,7 @@ void FGJoystickInput::update( double dt ) FGButton &b = bindings[i].buttons[j]; b.last_dt += dt; if(b.last_dt >= b.interval_sec) { - bindings[i].buttons[j].update( modifiers, (buttons & (1 << j)) > 0 ); + bindings[i].buttons[j].update( modifiers, (buttons & (1u << j)) > 0 ); b.last_dt -= b.interval_sec; } } From 5303d15aa32b14c42784bc65e88a090f3b7f0f6a Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Fri, 8 Jul 2011 10:56:18 +0200 Subject: [PATCH 10/36] Fix #369: ATIS receiver has excessive range Add a range filter when searching for CommStations, searching by frequency is not enough. --- src/ATCDCL/ATCmgr.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ATCDCL/ATCmgr.cxx b/src/ATCDCL/ATCmgr.cxx index 8d8a6fc58..0b93d6a20 100644 --- a/src/ATCDCL/ATCmgr.cxx +++ b/src/ATCDCL/ATCmgr.cxx @@ -250,8 +250,25 @@ void FGATCMgr::FreqSearch(const string navcomm, const int unit) { _aircraftPos = SGGeod::fromDegFt(lon_node->getDoubleValue(), lat_node->getDoubleValue(), elev_node->getDoubleValue()); + + class RangeFilter : public CommStation::Filter { + public: + RangeFilter( const SGGeod & pos ) : CommStation::Filter(), _pos(pos) {} + virtual bool pass(FGPositioned* aPos) const { + flightgear::CommStation * stn = dynamic_cast(aPos); + if( NULL == stn ) return false; + double dist = SGGeodesy::distanceNm( stn->geod(), _pos ); + // if range is not configured, assume at least 10NM range + // TODO: maybe ramp down range with proximity to ground? + return dist <= SGMiscd::max( stn->rangeNm(), 10.0 ); + } + private: + SGGeod _pos; + }; + + RangeFilter rangeFilter(_aircraftPos ); - CommStation* sta = CommStation::findByFreq(freqKhz, _aircraftPos); + CommStation* sta = CommStation::findByFreq(freqKhz, _aircraftPos, &rangeFilter ); if (!sta) { ZapOtherService(ncunit, "x x x"); return; From cbc048b8010347dcbc3a46186e8d4ff94c29d668 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sun, 10 Jul 2011 12:52:45 +0200 Subject: [PATCH 11/36] Fix minor DME frequency issue. DME frequency value should be double - not string. --- src/Main/options.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Main/options.cxx b/src/Main/options.cxx index ff306e6d9..9e1b5c55b 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1132,10 +1132,16 @@ fgOptDME( const char *arg ) fgSetString("/instrumentation/dme/frequencies/source", "/instrumentation/nav[1]/frequencies/selected-mhz"); } else { + double frequency = atof(arg); + if (frequency==0.0) + { + SG_LOG(SG_INPUT, SG_ALERT, "Invalid DME frequency: '" << arg << "'."); + return FG_OPTIONS_ERROR; + } fgSetInt("/instrumentation/dme/switch-position", 2); fgSetString("/instrumentation/dme/frequencies/source", "/instrumentation/dme/frequencies/selected-mhz"); - fgSetString("/instrumentation/dme/frequencies/selected-mhz", arg); + fgSetDouble("/instrumentation/dme/frequencies/selected-mhz", frequency); } return FG_OPTIONS_OK; } From 963d1abe01739f5d953496b5131a0668ac0b6534 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sun, 10 Jul 2011 21:21:34 +0200 Subject: [PATCH 12/36] Non-conclusive update for list of contributors. --- Thanks | 94 ++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 19 deletions(-) diff --git a/Thanks b/Thanks index 0a9c0655e..09aa745d7 100644 --- a/Thanks +++ b/Thanks @@ -36,9 +36,11 @@ Raul Alonzo Michele America Contributed to the HUD code. + Emmanuel Baranger <> Many, many very nice aircraft models. + Andrei Barbu Designed and implemented the current version of the FlightGear website. @@ -74,13 +76,16 @@ Paul Bleisch Also contributed a first stab at a config file/command line parsing system. + Matthias Boerner <> Coorganizer of the FlightGear booth at the annual LinuxTag event in Germany. + Alexis Bory Very nice models, including the F14-B. + Jim Brennan Provided a big chunk of online space to store USA scenery for Flight Gear. @@ -91,8 +96,10 @@ Bernie Bright Threading support and threaded tile pager. Initiate the fgrun project + Francesco Brisa <> Scenery models and ground networks for Italian airports. + Scripts for automated source downloads and builds. Bernhard H. Buckel @@ -128,6 +135,11 @@ John Check New instrument panel configurations +Bertrand Coconnier + Contributed several bugfixes and improvements for the integration of + the JSBSim flight dynamics model. + + Dave Cornish Created our new, super cool, runway textures. Created some of our cloud textures. @@ -139,15 +151,24 @@ Oliver Delise Founder of the FlightGear MultiPilot Project : http://www.isis.de/members/~odelise/progs/flightgear + +John Denker + Contributed bugfixes and improvements to the navigation and ATIS code. + + Jean-Francois Doue Vector 2D, 3D, 4D and Matrix 3D and 4D inlined C++ classes. (Based on Graphics Gems IV ed. Paul S. Heckbert) http://www.animats.com/simpleppp/ftp/public_html/topics/developers.html + Torsten Dreyer - Contributed a very nice Piper Sceneca, closely modelled after the - real thing. - Many other nice aircraft, buildings, etc etc. + Contributed the very nice Piper Seneca, closely modelled after the + real thing. Also added many other nice aircraft (such as the ogeL, also + closely modelled after the real thing), buildings, etc. + Creator of fgpanel. Code maintainer of weather, environment, autopilot + and many other core systems. + Dave Eberly Contributed some sphere interpolation code used by Christian Mayer's @@ -155,9 +176,11 @@ Dave Eberly really useful looking code available there. http://www.magic-software.com + Martin Eschen <> Helped enourmously toward finishing the full scale traffic demo at EHAM. + Francine Evans Wrote the @#$@#$@% GPL'd tri-striper we use and "love". :-) http://www.cs.sunysb.edu/~evans/stripe.html @@ -168,6 +191,7 @@ Oscar Everitt for FS98. They are pretty cool and Oscar was happy to contribute them to our little project. + Detlef Faber Many WWII era aircraft. @@ -175,13 +199,16 @@ Detlef Faber Leidson Campos A. Ferreira Rewrote the Jpeg screen httpd streaming (--jpg-httpd option) + Olaf Flebbe Improved the build system for Windows and provided pre-built dependencies. + Bruce Finney MSVC5 compatibility. + Thomas Förster <> Updates to the AI system, including the Dykstra route finding algorithm, adding a performance class, and many code clean-ups. @@ -209,14 +236,17 @@ Jean-loup Gailly and Mark Adler Thomas Gellekum Changes and updates for compiling on FreeBSD + Ralf Gerlich <> Technical Genius behind the Custom Scenery Project. Current maintainer of TaxiDraw + Anders Gidenstam <> Support for Lighter than Air vehicles. Author of the ZeppelinNT. + Neetha Girish Contributed the xml configurable HUD changes. @@ -235,18 +265,22 @@ Michael I. Gold Habibie RedHat package building changes for SimGear. + Csaba Halász <> Many bugfixes and code checking. + Ampere Hardraade <> Many detailed 3D models of aircraft, including the MD11, and several Airbuses. + Brett Harrison <> Ground networks for various airports. Most of the liveries for the new C172p by HHS. AI Repaints for several 737's and C172's + Dave Haskell Original exterior textures for the Cessna 310 U-3A model. Only a few minor modifications were made. @@ -277,6 +311,7 @@ Bruce Jackson of NASA the flight model. Bruce has patiently answered my many, many questions. http://dcb.larc.nasa.gov/www/DCBStaff/ebj/ebj.html + Ron Jensen Contributed to the piston engine code in JSBSim. @@ -402,10 +437,12 @@ Phil Nelson Author of GNU dbm. gdbm is a set of database routines that use extendible hashing and works similar to the standard UNIX dbm routines. + Tatsuhiro Nishioka Maintainer of the Mac port. Contributed some very nice Japanese aircraft models. + Alexei Novikov Created European Scenery Contributed a script to turn fgfs scenery into beautifully rendered @@ -445,9 +482,11 @@ Alex Perry Contributed code to more accurately model VSI, DG, Altitude. Contributed to the Install and Getting Started manual. + Pigeon <> Developed the multiplayer network infrastructure. + Friedemann Reinhard Contributed beginnings of a textured instrument panel. @@ -465,7 +504,6 @@ Frederic Bouvier the windows community. - Petter Reinholdtsen Incorporated the Gnu automake/autoconf system (with libtool). This should streamline and standardize the build process for all @@ -473,22 +511,32 @@ Petter Reinholdtsen environments since the don't use the Unix make system. +Thorsten Renk + Created the local weather system, providing beautiful cloudscapes + and an accurate meteorological simulation. + + William Riley Contributed code to add "brakes". Patch to support a first joystick with more than two axes. World scenery based on vmap0 data. + Gijs de Rooy <> Contributed some very nice building models, including a very detailed layout of the Amsterdam airport terminals, and many downtown buildings. - Redid the Boeing 747-400 3D model - Very active first aid responder on the official Flightgear - forum. - + Redid the Boeing 747-400 3D model. + Greatly contributed to the FlightGear community as a very active + first aid responder on the official Flightgear forum, as a forum + and wiki admin, and as the editor of the monthly FlightGear + newsletter. + + Gerard Robin <> Many nice Aircraft models + Andy Ross Contributed a new configurable FDM, "YASim", based on geometry information rather than aerodynamic coefficients. @@ -497,19 +545,23 @@ Andy Ross Modified the UI code to allow a far more flexible grouping system. Added the Nasal scripting language and added FlightGear integration. + Brian Schack <> Current maintainer of Atlas, the moving map program for FlightGear - + + Paul Schlyter Mr. Schlyter provided Durk Talsma with all the information he needed to write the astro code. Mr. S. is also willing to answer astro-related questions whenever one needs to. http://welcome.to/pausch + Christian Schmitt <> Detailed Frankfurt airport buildings. Contributions to the custom scenery project. + Chris Schoeneman Contributed some 3d sound playing code for Irix, Win32, and Linux It is unclear if this code will be used directly, but it certainly @@ -519,7 +571,8 @@ Chris Schoeneman Phil Schubert Contributed various textures and engine modelling. http://www.zedley.com/Philip/index.htm - + + Heiko Schulz <> Contributed AI traffic for EDDF EDDF Night lights @@ -549,9 +602,11 @@ Martin Spott Germany. Manages the "World Scenery" releases. + Jon Stockill <> Maintainer of the object database. + Martin Dressler Created some outstanding panel instrumentation textures for use in full-screen mode. @@ -573,16 +628,19 @@ Durk Talsma Full scale AI traffic demo for EHAM. Current FlightGear release manager. + Gabor Toth <> Contributed some Livery repaints for AI Aircraft Contributed many ideas leading towards the Traffic Manager II format Runs FGTracker, an online flight tracking service for FlightGear + James Turner <> Many code cleanups of the internal structure of the airport database, runway parsing, route management. Is currently working on adding flightmanagement support. + UIUC - Department of Aeronautical and Astronautical Engineering Contributed modifications to LaRCsim to allow loading of aircraft parameters from a file. These modifications were made as part of an @@ -683,14 +741,17 @@ Jean-Claude Wippler X/MIT-style license. Please see the following URL for more info: http://www.equi4.com/metakit + Holger Wirtz <> -Author of FGCom, a voice communication program intented for FlightGear -multiplayer/ATC. + Author of FGCom, a voice communication program intented for FlightGear + multiplayer/ATC. + John Wojnaroski Open Glass Cockpit project 3d clouds + Marcus Zojer <> Contributed a B1B aircraft model. @@ -783,7 +844,7 @@ SkyscraperPage.com http://skyscraperpage.com WoodSoup Project http://www.woodsoup.org [ FlightGear no longer uses woodsoup services, but we appreciate the support provided to our project during the time they hosted us. ] - Provided computing resources and services so that the Flight Gear + Provided computing resources and services so that the FlightGear project could have real home. This includes, web services, ftp services, shell accounts, email lists, dns services, etc. @@ -802,12 +863,7 @@ THIS DOCUMENT WAS INITIALLY WRITTEN BY Curt L. Olson - -THE CONTENTS WERE LASTLY RESEARCHED AND UPDATED MARCH, 8 2000 - -Oliver Delise - - +Updated 2000-03-08 by Oliver Delise, delise@mail.isis.de Updated 2001-12-11 by David Megginson, david@megginson.com Updated 2003-04-17, Updated 2004-06-01, From ccd6a094f1f522510d6a342a0898b15dd41a6293 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sun, 10 Jul 2011 21:25:16 +0200 Subject: [PATCH 13/36] Avoid creation of stray "/null" property nodes. "property-assign" command had a side-effect of creating stray "/null" nodes when assigning a value (since "getprop2" always creates some node). --- src/Main/fg_commands.cxx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 7711f6b4f..ef2824089 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -726,15 +726,18 @@ static bool do_property_assign (const SGPropertyNode * arg) { SGPropertyNode * prop = get_prop(arg); - const SGPropertyNode * prop2 = get_prop2(arg); const SGPropertyNode * value = arg->getNode("value"); if (value != 0) return prop->setUnspecifiedValue(value->getStringValue()); - else if (prop2) - return prop->setUnspecifiedValue(prop2->getStringValue()); else - return false; + { + const SGPropertyNode * prop2 = get_prop2(arg); + if (prop2) + return prop->setUnspecifiedValue(prop2->getStringValue()); + else + return false; + } } @@ -1064,14 +1067,9 @@ static bool do_add_model (const SGPropertyNode * arg) { SGPropertyNode * model = fgGetNode("models", true); - for (int i = 0;; i++) { - if (i < 0) - return false; - if (!model->getChild("model", i, false)) { - model = model->getChild("model", i, true); - break; - } - } + int i; + for (i = 0; model->hasChild("model",i); i++); + model = model->getChild("model", i, true); copyProperties(arg, model); if (model->hasValue("elevation-m")) model->setDoubleValue("elevation-ft", model->getDoubleValue("elevation-m") From 557b16da6e2533ac3209f7aa5371af456aa7fa4a Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 10 Jul 2011 21:56:47 +0200 Subject: [PATCH 14/36] Some more "Thanks" --- Thanks | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Thanks b/Thanks index 09aa745d7..3b0117610 100644 --- a/Thanks +++ b/Thanks @@ -82,6 +82,11 @@ Matthias Boerner <> Germany. +Thorsten Brehm + Thorsten provided the TCAS system and fixed an uncountable number of + bugs, closed memory leaks and helps creating new releases. + + Alexis Bory Very nice models, including the F14-B. @@ -601,6 +606,8 @@ Martin Spott Coorganizer of the FlightGear booth at the annual LinuxTag event in Germany. Manages the "World Scenery" releases. + Maintains world's biggest repository and toolchain for free and + open map and scenery data at http://mapserver.flightgear.org/ Jon Stockill <> @@ -789,6 +796,7 @@ Mathias Fr land on aircraft carriers. Modified YASim, JSBSim and LaRCsim to support the groundcache code. Reorganized the code to eliminate the viewer jitter for close by objects. + Matthias is responsible for the transition to OSG and he added HLA support. Harald Johnsen From dcc8d22f7c19512941d76d47a7f5fffbbec94fbd Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Wed, 13 Jul 2011 21:52:29 +0200 Subject: [PATCH 15/36] Don't crash on exit, when initialization was aborted. Some errors cause fgfs to abort/exit before "controls" is set. --- src/Main/globals.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 9ed3a6b56..91af653c0 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -182,8 +182,12 @@ FGGlobals::~FGGlobals() delete current_panel; delete ATC_mgr; - controls->unbind(); - delete controls; + + if (controls) + { + controls->unbind(); + delete controls; + } delete channel_options_list; delete initial_waypoints; From 80f909246052c77d9f7f6459c7f4342d8ae6f927 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Thu, 14 Jul 2011 00:22:35 +0200 Subject: [PATCH 16/36] Fix issue reported by heap debugger Subsystems are erased by the subsystem manager - so better avoid dependencies in their destructors. --- src/Scenery/tilemgr.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index dae8cb3b5..6eeb70667 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -87,9 +87,6 @@ FGTileMgr::FGTileMgr(): FGTileMgr::~FGTileMgr() { - if (_terra_sync) - _terra_sync->setTileCache(NULL); - // remove all nodes we might have left behind osg::Group* group = globals->get_scenery()->get_terrain_branch(); group->removeChildren(0, group->getNumChildren()); From e389b4559960b1682adc79f323a9323b519f0b20 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Fri, 15 Jul 2011 17:42:19 +0200 Subject: [PATCH 17/36] Provide command line arguments for fgviewer. Provide --fg-root and --fg-scenery command line processing for fgviewer. --- utils/fgviewer/fgviewer.cxx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/utils/fgviewer/fgviewer.cxx b/utils/fgviewer/fgviewer.cxx index c65d8ebd6..a09cdf781 100644 --- a/utils/fgviewer/fgviewer.cxx +++ b/utils/fgviewer/fgviewer.cxx @@ -90,29 +90,31 @@ main(int argc, char** argv) fog->setDensity(1e-6); camera->getOrCreateStateSet()->setAttribute(fog); - const char *fg_root_env = std::getenv("FG_ROOT"); std::string fg_root; - if (fg_root_env) + if (arguments.read("--fg-root", fg_root)) { + } else if (const char *fg_root_env = std::getenv("FG_ROOT")) { fg_root = fg_root_env; - else + } else { #if defined(PKGDATADIR) fg_root = PKGDATADIR; #else fg_root = "."; #endif + } - osgDB::FilePathList filePathList; - filePathList.push_back(fg_root); - - const char *fg_scenery_env = std::getenv("FG_SCENERY"); + std::string fg_scenery; string_list path_list; - if (fg_scenery_env) { + if (arguments.read("--fg-scenery", fg_scenery)) { + path_list.push_back(fg_scenery); + } else if (const char *fg_scenery_env = std::getenv("FG_SCENERY")) { path_list = sgPathSplit(fg_scenery_env); } else { SGPath path(fg_root); path.append("Scenery"); path_list.push_back(path.str()); } + osgDB::FilePathList filePathList; + filePathList.push_back(fg_root); for (unsigned i = 0; i < path_list.size(); ++i) { SGPath pt(path_list[i]), po(path_list[i]); pt.append("Terrain"); @@ -153,6 +155,10 @@ main(int argc, char** argv) btgOptions->getDatabasePathList() = filePathList; btgOptions->setMatlib(ml); + // Here, all arguments are processed + arguments.reportRemainingOptionsAsUnrecognized(); + arguments.writeErrorMessages(std::cerr); + // read the scene from the list of file specified command line args. osg::ref_ptr loadedModel; loadedModel = osgDB::readNodeFiles(arguments, btgOptions); From c2a397d4fcf19adaa2706ba8b2ca76e67379c200 Mon Sep 17 00:00:00 2001 From: Anders Gidenstam Date: Sat, 16 Jul 2011 00:16:20 +0200 Subject: [PATCH 18/36] Updated my entry in the Thanks file. --- Thanks | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Thanks b/Thanks index 3b0117610..28274e8ff 100644 --- a/Thanks +++ b/Thanks @@ -248,8 +248,10 @@ Ralf Gerlich <> Anders Gidenstam <> - Support for Lighter than Air vehicles. - Author of the ZeppelinNT. + Added support for lighter than air vehicles to JSBSim. + Contributed simulation of wildfires and a basic system for dual control + of an aircraft over the multiplayer network. + Author of several airships and one aircraft. Neetha Girish From 529ce6b26efcee372d8648123fb76864734a107a Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Sat, 16 Jul 2011 08:23:47 +0200 Subject: [PATCH 19/36] Fix typo :) --- Thanks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Thanks b/Thanks index 28274e8ff..f1101fac5 100644 --- a/Thanks +++ b/Thanks @@ -798,7 +798,7 @@ Mathias Fr land on aircraft carriers. Modified YASim, JSBSim and LaRCsim to support the groundcache code. Reorganized the code to eliminate the viewer jitter for close by objects. - Matthias is responsible for the transition to OSG and he added HLA support. + Mathias is responsible for the transition to OSG and he added HLA support. Harald Johnsen From 8e682cb8a4e6275726feb0da333937717aaf0207 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 16 Jul 2011 13:25:29 +0100 Subject: [PATCH 20/36] Disable flight-related key-bindings in the WaypointList widget for 2.4 release, pending a better solution to PLIB's lack of focus. --- src/GUI/WaypointList.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/GUI/WaypointList.cxx b/src/GUI/WaypointList.cxx index 4f9d68b13..235ef960f 100644 --- a/src/GUI/WaypointList.cxx +++ b/src/GUI/WaypointList.cxx @@ -21,6 +21,11 @@ #include #include +// select if the widget grabs keys necessary to fly aircraft from the keyboard, +// or not. See http://code.google.com/p/flightgear-bugs/issues/detail?id=338 +// for discussion about why / what is going on. +#define AVOID_FLIGHT_KEYS 1 + using namespace flightgear; enum { @@ -659,6 +664,10 @@ int WaypointList::checkKey (int key, int updown ) if ((updown == PU_UP) || !isVisible () || !isActive () || (window != puGetWindow())) { return FALSE ; } + +#ifdef AVOID_FLIGHT_KEYS + return FALSE; +#endif switch (key) { From 172c635f03827d936e498307a3a21cb305b14511 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 17 Jul 2011 10:47:27 +0200 Subject: [PATCH 21/36] Bump version to 2.4.0 --- CMakeLists.txt | 2 +- src/Main/main.cxx | 2 +- version | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe7610f4f..d82a8f4ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,7 +131,7 @@ if(ENABLE_LIBSVN) endif(ENABLE_LIBSVN) find_package(PLIB REQUIRED puaux pu js fnt) -find_package(SimGear 2.3.0 REQUIRED) +find_package(SimGear 2.4.0 REQUIRED) check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(sys/time.h HAVE_SYS_TIME_H) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 1c4a7410f..e9b2587d7 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -615,7 +615,7 @@ int fgMainInit( int argc, char **argv ) { fgInitFGRoot(argc, argv); // Check for the correct base package version - static char required_version[] = "2.3.0"; + static char required_version[] = "2.4.0"; string base_version = fgBasePackageVersion(); if ( !(base_version == required_version) ) { // tell the operator how to use this application diff --git a/version b/version index 276cbf9e2..197c4d5c2 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.3.0 +2.4.0 From c238f86637ff57a46a08c32cba58ab5c750e9aad Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 17 Jul 2011 11:07:07 +0200 Subject: [PATCH 22/36] Bump to version 2.5.0 --- CMakeLists.txt | 2 +- src/Main/main.cxx | 2 +- version | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d82a8f4ad..429f22ff3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,7 +131,7 @@ if(ENABLE_LIBSVN) endif(ENABLE_LIBSVN) find_package(PLIB REQUIRED puaux pu js fnt) -find_package(SimGear 2.4.0 REQUIRED) +find_package(SimGear 2.5.0 REQUIRED) check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(sys/time.h HAVE_SYS_TIME_H) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index e9b2587d7..2a2db1344 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -615,7 +615,7 @@ int fgMainInit( int argc, char **argv ) { fgInitFGRoot(argc, argv); // Check for the correct base package version - static char required_version[] = "2.4.0"; + static char required_version[] = "2.5.0"; string base_version = fgBasePackageVersion(); if ( !(base_version == required_version) ) { // tell the operator how to use this application diff --git a/version b/version index 197c4d5c2..437459cd9 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.4.0 +2.5.0 From 2b7c8cdff9f0fb767138e295803985bdcbf5b6e4 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 17 Jul 2011 12:16:12 +0200 Subject: [PATCH 23/36] Make configure.ac check for SimGear 2.5.0 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 179d63f51..e1725ce50 100644 --- a/configure.ac +++ b/configure.ac @@ -583,7 +583,7 @@ if test "x$ac_cv_header_simgear_version_h" != "xyes"; then exit fi -AC_MSG_CHECKING([for SimGear 2.3.0 or newer]) +AC_MSG_CHECKING([for SimGear 2.5.0 or newer]) AC_TRY_RUN([ #include From b0566a3ed0f8b519f1ede49ddd5699c337fbf6a9 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 17 Jul 2011 11:58:46 +0100 Subject: [PATCH 24/36] Fix make dist rule for removed files. (will pick to 2.4) --- src/Network/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Network/Makefile.am b/src/Network/Makefile.am index e4ecc3b10..6ec004124 100644 --- a/src/Network/Makefile.am +++ b/src/Network/Makefile.am @@ -1,5 +1,4 @@ -EXTRA_DIST = jpg-httpd.cxx jpg-httpd.hxx \ - multiplay.cxx multiplay.hxx +EXTRA_DIST = jpg-httpd.cxx jpg-httpd.hxx noinst_LIBRARIES = libNetwork.a From eab9a65ebc6fbf5cc09fe03333a24fb2974ba8bd Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 17 Jul 2011 19:31:28 +0200 Subject: [PATCH 25/36] Fix some gcc warnings --- src/Instrumentation/navradio.cxx | 3 ++- src/Main/bootstrap.cxx | 6 +----- src/Navaids/awynet.cxx | 2 +- src/Traffic/Schedule.cxx | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Instrumentation/navradio.cxx b/src/Instrumentation/navradio.cxx index bde228991..780094c42 100644 --- a/src/Instrumentation/navradio.cxx +++ b/src/Instrumentation/navradio.cxx @@ -897,7 +897,8 @@ void FGNavRadio::updateAudio() } last_time = now; - play_count = ++play_count % NUM_IDENT_SLOTS; + play_count++; + play_count %= NUM_IDENT_SLOTS; // Previous ident is out of time; if still playing, cut it off: _sgr->stop( nav_fx_name ); diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index fb95b8f19..a4ba24bd0 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -71,10 +71,10 @@ bool free_hostname = false; void fgExitCleanup(); static bool fpeAbort = false; -static void handleFPE(int); static void initFPE(); #if defined(HAVE_FEENABLEEXCEPT) +static void handleFPE(int); static void initFPE () { @@ -115,10 +115,6 @@ handleFPE (int num) SG_LOG(SG_GENERAL, SG_ALERT, "Floating point interrupt (SIGFPE)"); } #else -static void handleFPE(int) -{ -} - static void initFPE() { } diff --git a/src/Navaids/awynet.cxx b/src/Navaids/awynet.cxx index 4432c8d71..0869fc2f7 100644 --- a/src/Navaids/awynet.cxx +++ b/src/Navaids/awynet.cxx @@ -317,7 +317,7 @@ void FGAirwayNetwork::load(const SGPath& path) int FGAirwayNetwork::findNearestNode(const SGGeod& aPos) { double minDist = HUGE_VAL; - int index; + int index = -1; SGVec3d cart = SGVec3d::fromGeod(aPos); //cerr << "Lat " << lat << " lon " << lon << endl; diff --git a/src/Traffic/Schedule.cxx b/src/Traffic/Schedule.cxx index cb7fafb3d..20d30609c 100644 --- a/src/Traffic/Schedule.cxx +++ b/src/Traffic/Schedule.cxx @@ -221,7 +221,7 @@ bool FGAISchedule::update(time_t now, const SGVec3d& userCart) // Check if this aircraft has been released. FGTrafficManager *tmgr = (FGTrafficManager *) globals->get_subsystem("Traffic Manager"); if (tmgr->isReleased(AIManagerRef)) { - AIManagerRef = NULL; + AIManagerRef = 0; } else { return true; // in visual range, let the AIManager handle it } From c1d150a8e52a37ba905d5c022da9f51b2169b6dc Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 17 Jul 2011 19:32:16 +0200 Subject: [PATCH 26/36] Ray protocol: don't use hardcoded gravity 9.81 --- src/Network/ray.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Network/ray.cxx b/src/Network/ray.cxx index b85831087..855a644a8 100644 --- a/src/Network/ray.cxx +++ b/src/Network/ray.cxx @@ -29,7 +29,7 @@ #include #include - +#include #include "ray.hxx" @@ -76,7 +76,7 @@ bool FGRAY::gen_message() { double dt = 0.05; /* seconds */ /* get basic information about gravity */ - double grav_acc = -9.81; + double grav_acc = -Environment::Gravity::instance()->getGravity( f.getPosition() ); double vert_acc = f.get_A_Z_pilot() * 0.3; if ( -3.0 < vert_acc ) vert_acc = -3.0; From 1cf7e78ae5c8fe47e586219e619a737290c2d029 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 17 Jul 2011 22:15:57 +0200 Subject: [PATCH 27/36] Fix compile for 32bit (handleFPE() undeclared) --- src/Main/bootstrap.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index a4ba24bd0..c29440dba 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -93,6 +93,7 @@ static void handleFPE(int) } #elif defined(__linux__) && defined(__i386__) +static void handleFPE(int); static void initFPE () { From ca02aa8a049e25d544321d293b0ca23dac350ef2 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sun, 17 Jul 2011 22:26:37 +0200 Subject: [PATCH 28/36] JoystickInput: fix potential init problem Don't remember the axis position before bindings are loaded --- src/Input/FGJoystickInput.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Input/FGJoystickInput.cxx b/src/Input/FGJoystickInput.cxx index 3f490f5cb..0d0a86ce9 100644 --- a/src/Input/FGJoystickInput.cxx +++ b/src/Input/FGJoystickInput.cxx @@ -305,7 +305,9 @@ void FGJoystickInput::update( double dt ) // Do nothing if the axis position // is unchanged; only a change in // position fires the bindings. - if (fabs(axis_values[j] - a.last_value) > a.tolerance) { + // But only if there are bindings + if (fabs(axis_values[j] - a.last_value) > a.tolerance + && a.bindings[KEYMOD_NONE].size() > 0 ) { a.last_value = axis_values[j]; for (unsigned int k = 0; k < a.bindings[KEYMOD_NONE].size(); k++) a.bindings[KEYMOD_NONE][k]->fire(axis_values[j]); From 24383e51941e52adf7e12181e4000b5d71e1bad3 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Mon, 18 Jul 2011 10:24:52 +0200 Subject: [PATCH 29/36] Two minor MSVC90 build fixes - provide SIMGEAR_VERSION in no_version.h - remove duplicate define of FLIGHTGEAR_VERSION --- src/Include/config.h-msvc90 | 3 ++- src/Include/no_version.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Include/config.h-msvc90 b/src/Include/config.h-msvc90 index e2c38e1eb..9b789a10c 100644 --- a/src/Include/config.h-msvc90 +++ b/src/Include/config.h-msvc90 @@ -19,7 +19,8 @@ #define PACKAGE "FlightGear" /* Define to package version - use in main.cxx */ -#define FLIGHTGEAR_VERSION "MSVC9.0-WIN32-2.0.0" +// define in version.h and no_version.h +/* #define FLIGHTGEAR_VERSION "MSVC9.0-WIN32-2.0.0" */ /* Define as the return type of signal handlers (int or void). */ #define RETSIGTYPE void diff --git a/src/Include/no_version.h b/src/Include/no_version.h index 4e33838b8..ad96259e8 100644 --- a/src/Include/no_version.h +++ b/src/Include/no_version.h @@ -8,9 +8,10 @@ // placeholder values instead. #define FLIGHTGEAR_VERSION "development " __DATE__ +#define SIMGEAR_VERSION FLIGHTGEAR_VERSION #define HUDSON_BUILD_NUMBER 0 #define HUDSON_BUILD_ID "none" #define REVISION "unknown" -#endif \ No newline at end of file +#endif From c6d5b6ebdb34954ca9fc43bb49ace4b6d3b47754 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Mon, 18 Jul 2011 11:09:43 +0200 Subject: [PATCH 30/36] Partial fix for #228: ambiguous navaid-names This fixes at least the startup process. If an ambigous fix name was presented with --vor=ID or --ndb=ID present a list of matching records along with frequency and position in the console to give the user the chance to pick the correct one by adding the frequency with --vor-frequency=nnn.nn It does not yes solve the issue when the user relocates using the GUI dialog. This requires some GUI and Nasal hacking along with a new Nasal helper function "navaidinfo". --- src/Main/fg_init.cxx | 46 +++++++++++++++++++++++--------- src/Main/options.cxx | 4 ++- src/Navaids/navlist.cxx | 59 ++++++++++++++++++++++++++++++++--------- src/Navaids/navlist.hxx | 14 +++++++--- 4 files changed, 93 insertions(+), 30 deletions(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 9fd101b65..cc62744cd 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -996,18 +997,37 @@ static void fgSetDistOrAltFromGlideSlope() { // Set current_options lon/lat given an airport id and heading (degrees) -static bool fgSetPosFromNAV( const string& id, const double& freq ) { - FGNavRecord *nav - = globals->get_navlist()->findByIdentAndFreq( id.c_str(), freq ); +static bool fgSetPosFromNAV( const string& id, const double& freq, FGPositioned::Type type ) { - if (!nav) { - SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate NAV = " - << id << ":" << freq ); - return false; - } - - fgApplyStartOffset(nav->geod(), fgGetDouble("/sim/presets/heading-deg")); - return true; + const nav_list_type navlist + = globals->get_navlist()->findByIdentAndFreq( id.c_str(), freq, type ); + + if (navlist.size() == 0 ) { + SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate NAV = " + << id << ":" << freq ); + return false; + } + + if( navlist.size() > 1 ) { + ostringstream buf; + buf << "Ambigous NAV-ID: '" << id << "'. Specify id and frequency. Available stations:" << endl; + for( nav_list_type::const_iterator it = navlist.begin(); it != navlist.end(); ++it ) { + // NDB stored in kHz, VOR stored in MHz * 100 :-P + double factor = (*it)->type() == FGPositioned::NDB ? 1.0 : 1/100.0; + string unit = (*it)->type() == FGPositioned::NDB ? "kHz" : "MHz"; + buf << (*it)->ident() << " " + << setprecision(5) << (double)((*it)->get_freq() * factor) << " " + << (*it)->get_lat() << "/" << (*it)->get_lon() + << endl; + } + + SG_LOG( SG_GENERAL, SG_ALERT, buf.str() ); + return false; + } + + FGNavRecord *nav = navlist[0]; + fgApplyStartOffset(nav->geod(), fgGetDouble("/sim/presets/heading-deg")); + return true; } // Set current_options lon/lat given an aircraft carrier id @@ -1219,14 +1239,14 @@ bool fgInitPosition() { if ( !set_pos && !vor.empty() ) { // a VOR is requested - if ( fgSetPosFromNAV( vor, vor_freq ) ) { + if ( fgSetPosFromNAV( vor, vor_freq, FGPositioned::VOR ) ) { set_pos = true; } } if ( !set_pos && !ndb.empty() ) { // an NDB is requested - if ( fgSetPosFromNAV( ndb, ndb_freq ) ) { + if ( fgSetPosFromNAV( ndb, ndb_freq, FGPositioned::NDB ) ) { set_pos = true; } } diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 9e1b5c55b..00ace6e4b 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -59,7 +59,6 @@ #include
#include -#include #include using std::string; @@ -70,6 +69,7 @@ using std::endl; #if defined( HAVE_VERSION_H ) && HAVE_VERSION_H # include +# include #else # include #endif @@ -1341,7 +1341,9 @@ struct OptionDesc { {"airport", true, OPTION_STRING, "/sim/presets/airport-id", false, "", 0 }, {"runway", true, OPTION_FUNC, "", false, "", fgOptRunway }, {"vor", true, OPTION_FUNC, "", false, "", fgOptVOR }, + {"vor-frequency", true, OPTION_DOUBLE, "/sim/presets/vor-freq", false, "", fgOptVOR }, {"ndb", true, OPTION_FUNC, "", false, "", fgOptNDB }, + {"ndb-frequency", true, OPTION_DOUBLE, "/sim/presets/ndb-freq", false, "", fgOptVOR }, {"carrier", true, OPTION_FUNC, "", false, "", fgOptCarrier }, {"parkpos", true, OPTION_FUNC, "", false, "", fgOptParkpos }, {"fix", true, OPTION_FUNC, "", false, "", fgOptFIX }, diff --git a/src/Navaids/navlist.cxx b/src/Navaids/navlist.cxx index bbe3eb424..6bbf59fa3 100644 --- a/src/Navaids/navlist.cxx +++ b/src/Navaids/navlist.cxx @@ -33,6 +33,8 @@ #include +#include + using std::string; // FGNavList ------------------------------------------------------------------ @@ -73,41 +75,74 @@ FGNavRecord *FGNavList::findByFreq( double freq, const SGGeod& position) return findNavFromList( position, stations ); } -class VORNDBFilter : public FGPositioned::Filter +class TypeFilter : public FGPositioned::Filter { public: + TypeFilter( const FGPositioned::Type mintype, const FGPositioned::Type maxtype ) : _mintype(mintype), _maxtype(maxtype) {} + virtual FGPositioned::Type minType() const { - return FGPositioned::VOR; + return _mintype; } virtual FGPositioned::Type maxType() const { - return FGPositioned::NDB; + return _maxtype; } +private: + FGPositioned::Type _mintype; + FGPositioned::Type _maxtype; }; // Given an Ident and optional freqency, return the first matching // station. -FGNavRecord *FGNavList::findByIdentAndFreq(const string& ident, const double freq ) +const nav_list_type FGNavList::findByIdentAndFreq(const string& ident, const double freq, const FGPositioned::Type type ) { FGPositionedRef cur; - VORNDBFilter filter; + TypeFilter filter( + type == FGPositioned::INVALID ? FGPositioned::VOR : type, + type == FGPositioned::INVALID ? FGPositioned::NDB : type ); + nav_list_type reply; + cur = FGPositioned::findNextWithPartialId(cur, ident, &filter); - if (freq <= 0.0) { - return static_cast(cur.ptr()); // might be null - } - int f = (int)(freq*100.0 + 0.5); while (cur) { FGNavRecord* nav = static_cast(cur.ptr()); - if (nav->get_freq() == f) { - return nav; + if ( f <= 0.0 || nav->get_freq() == f) { + reply.push_back( nav ); } cur = FGPositioned::findNextWithPartialId(cur, ident, &filter); } - return NULL; + return reply; +} + +class NavRecordDistanceSortPredicate +{ +public: + NavRecordDistanceSortPredicate( const SGGeod & position ) : + _position(SGVec3d::fromGeod(position)) {} + + bool operator()( const nav_rec_ptr & n1, const nav_rec_ptr & n2 ) + { + if( n1 == NULL || n2 == NULL ) return false; + return distSqr(n1->cart(), _position) < distSqr(n2->cart(), _position); + } +private: + SGVec3d _position; + +}; + +// Given an Ident and optional freqency and type , +// return a list of matching stations sorted by distance to the given position +const nav_list_type FGNavList::findByIdentAndFreq( const SGGeod & position, + const std::string& ident, const double freq, const FGPositioned::Type type ) +{ + nav_list_type reply = findByIdentAndFreq( ident, freq, type ); + NavRecordDistanceSortPredicate sortPredicate( position ); + std::sort( reply.begin(), reply.end(), sortPredicate ); + + return reply; } // discount navids if they conflict with another on the same frequency diff --git a/src/Navaids/navlist.hxx b/src/Navaids/navlist.hxx index f54e5db93..6b4b6365c 100644 --- a/src/Navaids/navlist.hxx +++ b/src/Navaids/navlist.hxx @@ -76,10 +76,16 @@ public: */ FGNavRecord *findByFreq( double freq, const SGGeod& position); - // Given an Ident and optional freqency, return the first matching - // station. - FGNavRecord *findByIdentAndFreq( const std::string& ident, - const double freq = 0.0 ); + // Given an Ident and optional freqency and type , + // return a list of matching stations. + const nav_list_type findByIdentAndFreq( const std::string& ident, + const double freq = 0.0, const FGPositioned::Type = FGPositioned::INVALID ); + + // Given an Ident and optional freqency and type , + // return a list of matching stations sorted by distance to the given position + const nav_list_type findByIdentAndFreq( const SGGeod & position, + const std::string& ident, const double freq = 0.0, + const FGPositioned::Type = FGPositioned::INVALID ); // given a frequency returns the first matching entry FGNavRecord *findStationByFreq( double frequency ); From 7c56cc617d13c1cc86d3f25c137b112197f1c224 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Mon, 18 Jul 2011 11:55:50 +0200 Subject: [PATCH 31/36] Fix minor memory leak in terrainsampler Thanks to ThorstenB --- src/Environment/terrainsampler.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Environment/terrainsampler.cxx b/src/Environment/terrainsampler.cxx index 293eb2c86..d3a0e7138 100644 --- a/src/Environment/terrainsampler.cxx +++ b/src/Environment/terrainsampler.cxx @@ -366,6 +366,7 @@ void TerrainSamplerImplementation::reinit() if( subsys == NULL ) break; remove_subsystem( subsystemName ); + delete subsys; } init(); From 7abf7c57482da1d2df8bb47036b83af444bad68c Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 26 Jun 2011 07:49:37 +0100 Subject: [PATCH 32/36] CMake header support for XCode/Visual Studio --- CMakeModules/FlightGearComponent.cmake | 2 +- src/AIModel/CMakeLists.txt | 25 +++++++++++++++++++++++-- src/Aircraft/CMakeLists.txt | 10 ++++++++-- src/Airports/CMakeLists.txt | 22 +++++++++++++++++++--- src/Autopilot/CMakeLists.txt | 18 +++++++++++++++++- src/Cockpit/CMakeLists.txt | 9 ++++++++- src/Environment/CMakeLists.txt | 23 +++++++++++++++++++++-- src/GUI/CMakeLists.txt | 17 +++++++++++++++-- src/Main/CMakeLists.txt | 25 +++++++++++++++++++++++-- src/Navaids/CMakeLists.txt | 18 ++++++++++++++++-- 10 files changed, 151 insertions(+), 18 deletions(-) diff --git a/CMakeModules/FlightGearComponent.cmake b/CMakeModules/FlightGearComponent.cmake index 7de5743b6..2b0daa93c 100644 --- a/CMakeModules/FlightGearComponent.cmake +++ b/CMakeModules/FlightGearComponent.cmake @@ -2,7 +2,7 @@ macro(flightgear_component name sources) set(libName "fg${name}") - add_library(${libName} STATIC ${sources} ) + add_library(${libName} STATIC ${sources} ${ARGV2}) set_property(GLOBAL APPEND PROPERTY FG_LIBS ${libName}) diff --git a/src/AIModel/CMakeLists.txt b/src/AIModel/CMakeLists.txt index 8cc8f74d2..08105fee0 100644 --- a/src/AIModel/CMakeLists.txt +++ b/src/AIModel/CMakeLists.txt @@ -23,6 +23,27 @@ set(SOURCES performancedb.cxx submodel.cxx ) - -flightgear_component(AIModel "${SOURCES}") + +set(HEADERS + AIAircraft.hxx + AIBallistic.hxx + AIBase.hxx + AICarrier.hxx + AIEscort.hxx + AIFlightPlan.hxx + AIGroundVehicle.hxx + AIManager.hxx + AIMultiplayer.hxx + AIShip.hxx + AIStatic.hxx + AIStorm.hxx + AITanker.hxx + AIThermal.hxx + AIWingman.hxx + performancedata.hxx + performancedb.hxx + submodel.hxx + ) + +flightgear_component(AIModel "${SOURCES}" "${HEADERS}") \ No newline at end of file diff --git a/src/Aircraft/CMakeLists.txt b/src/Aircraft/CMakeLists.txt index da519fb27..974d66559 100644 --- a/src/Aircraft/CMakeLists.txt +++ b/src/Aircraft/CMakeLists.txt @@ -4,5 +4,11 @@ set(SOURCES controls.cxx replay.cxx ) - -flightgear_component(Aircraft "${SOURCES}") \ No newline at end of file + +set(HEADERS + controls.hxx + replay.hxx + ) + + +flightgear_component(Aircraft "${SOURCES}" "${HEADERS}") \ No newline at end of file diff --git a/src/Airports/CMakeLists.txt b/src/Airports/CMakeLists.txt index 5be24c7df..43f2a999f 100644 --- a/src/Airports/CMakeLists.txt +++ b/src/Airports/CMakeLists.txt @@ -2,7 +2,6 @@ include(FlightGearComponent) set(SOURCES apt_loader.cxx - calc_loc.cxx dynamicloader.cxx dynamics.cxx gnnode.cxx @@ -17,5 +16,22 @@ set(SOURCES simple.cxx xmlloader.cxx ) - -flightgear_component(Airports "${SOURCES}") \ No newline at end of file + +set(HEADERS + apt_loader.hxx + dynamicloader.hxx + dynamics.hxx + gnnode.hxx + groundnetwork.hxx + parking.hxx + pavement.hxx + runwaybase.hxx + runwayprefloader.hxx + runwayprefs.hxx + runways.hxx + sidstar.hxx + simple.hxx + xmlloader.hxx + ) + +flightgear_component(Airports "${SOURCES}" "${HEADERS}") \ No newline at end of file diff --git a/src/Autopilot/CMakeLists.txt b/src/Autopilot/CMakeLists.txt index 23f297d2a..130edc0ab 100644 --- a/src/Autopilot/CMakeLists.txt +++ b/src/Autopilot/CMakeLists.txt @@ -16,4 +16,20 @@ set(SOURCES route_mgr.cxx ) -flightgear_component(Autopilot "${SOURCES}") \ No newline at end of file +set(HEADERS + analogcomponent.hxx + autopilot.hxx + autopilotgroup.hxx + component.hxx + digitalcomponent.hxx + digitalfilter.hxx + flipflop.hxx + inputvalue.hxx + logic.hxx + pidcontroller.hxx + pisimplecontroller.hxx + predictor.hxx + route_mgr.hxx + ) + +flightgear_component(Autopilot "${SOURCES}" "${HEADERS}") \ No newline at end of file diff --git a/src/Cockpit/CMakeLists.txt b/src/Cockpit/CMakeLists.txt index a9a070d74..d68022e77 100644 --- a/src/Cockpit/CMakeLists.txt +++ b/src/Cockpit/CMakeLists.txt @@ -6,4 +6,11 @@ set(SOURCES built_in/FGMagRibbon.cxx ) -flightgear_component(Cockpit "${SOURCES}") \ No newline at end of file +set(HEADERS + panel.hxx + panel_io.hxx + built_in/FGMagRibbon.hxx + ) + + +flightgear_component(Cockpit "${SOURCES}" "${HEADERS}") \ No newline at end of file diff --git a/src/Environment/CMakeLists.txt b/src/Environment/CMakeLists.txt index ada06638e..3007eb781 100644 --- a/src/Environment/CMakeLists.txt +++ b/src/Environment/CMakeLists.txt @@ -18,5 +18,24 @@ set(SOURCES presets.cxx gravity.cxx ) - -flightgear_component(Environment "${SOURCES}") + +set(HEADERS + atmosphere.hxx + environment.hxx + environment_ctrl.hxx + environment_mgr.hxx + ephemeris.hxx + fgclouds.hxx + fgmetar.hxx + fgwind.hxx + metarairportfilter.hxx + metarproperties.hxx + precipitation_mgr.hxx + realwx_ctrl.hxx + ridge_lift.hxx + terrainsampler.hxx + presets.hxx + gravity.hxx + ) + +flightgear_component(Environment "${SOURCES}" "${HEADERS}") diff --git a/src/GUI/CMakeLists.txt b/src/GUI/CMakeLists.txt index 706219c74..428cdcb9e 100644 --- a/src/GUI/CMakeLists.txt +++ b/src/GUI/CMakeLists.txt @@ -15,5 +15,18 @@ set(SOURCES new_gui.cxx property_list.cxx ) - -flightgear_component(GUI "${SOURCES}") + +set(HEADERS + AirportList.hxx + MapWidget.hxx + SafeTexFont.hxx + WaypointList.hxx + dialog.hxx + gui.h + layout.hxx + menubar.hxx + new_gui.hxx + property_list.hxx + ) + +flightgear_component(GUI "${SOURCES}" "${HEADERS}") diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index d28d78d26..c03bdaeed 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -31,8 +31,29 @@ set(SOURCES viewmgr.cxx ${RESOURCE_FILE} ) - -add_executable(fgfs ${SOURCES}) + +set(HEADERS + CameraGroup.hxx + FGEventHandler.hxx + WindowBuilder.hxx + WindowSystemAdapter.hxx + fg_commands.hxx + fg_init.hxx + fg_io.hxx + fg_props.hxx + fgviewer.hxx + globals.hxx + logger.hxx + main.hxx + options.hxx + renderer.hxx + splash.hxx + util.hxx + viewer.hxx + viewmgr.hxx + ) + +add_executable(fgfs ${SOURCES} ${HEADERS}) get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS) #message(STATUS "fg libs ${FG_LIBS}") diff --git a/src/Navaids/CMakeLists.txt b/src/Navaids/CMakeLists.txt index 8f2747270..05a999cb3 100644 --- a/src/Navaids/CMakeLists.txt +++ b/src/Navaids/CMakeLists.txt @@ -2,7 +2,6 @@ include(FlightGearComponent) set(SOURCES airways.cxx - awynet.cxx fixlist.cxx markerbeacon.cxx navdb.cxx @@ -16,4 +15,19 @@ set(SOURCES PositionedBinding.cxx ) -flightgear_component(Navaids "${SOURCES}") \ No newline at end of file +set(HEADERS + airways.hxx + fixlist.hxx + markerbeacon.hxx + navdb.hxx + navlist.hxx + navrecord.hxx + positioned.hxx + procedure.hxx + route.hxx + routePath.hxx + waypoint.hxx + PositionedBinding.hxx + ) + +flightgear_component(Navaids "${SOURCES}" "${HEADERS}") \ No newline at end of file From 1c8d8e7908bf711051b0080483f21f30c7cd0485 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 26 Jun 2011 07:55:36 +0100 Subject: [PATCH 33/36] More CMake headers support --- src/Model/CMakeLists.txt | 11 +++++++++-- src/MultiPlayer/CMakeLists.txt | 7 ++++++- src/Network/CMakeLists.txt | 32 ++++++++++++++++++++++++++++++-- src/Scenery/CMakeLists.txt | 11 +++++++++-- src/Scripting/CMakeLists.txt | 9 +++++++-- src/Sound/CMakeLists.txt | 13 +++++++++++-- src/Systems/CMakeLists.txt | 11 ++++++++++- src/Time/CMakeLists.txt | 8 +++++++- 8 files changed, 89 insertions(+), 13 deletions(-) diff --git a/src/Model/CMakeLists.txt b/src/Model/CMakeLists.txt index abfbee589..1933dac0d 100644 --- a/src/Model/CMakeLists.txt +++ b/src/Model/CMakeLists.txt @@ -6,5 +6,12 @@ set(SOURCES modelmgr.cxx panelnode.cxx ) - -flightgear_component(Model "${SOURCES}") \ No newline at end of file + +set(HEADERS + acmodel.hxx + model_panel.hxx + modelmgr.hxx + panelnode.hxx + ) + +flightgear_component(Model "${SOURCES}" "${HEADERS}") \ No newline at end of file diff --git a/src/MultiPlayer/CMakeLists.txt b/src/MultiPlayer/CMakeLists.txt index 3b2f42f53..1d5c7e992 100644 --- a/src/MultiPlayer/CMakeLists.txt +++ b/src/MultiPlayer/CMakeLists.txt @@ -5,4 +5,9 @@ set(SOURCES tiny_xdr.cxx ) -flightgear_component(MultiPlayer "${SOURCES}") \ No newline at end of file +set(HEADERS + multiplaymgr.hxx + tiny_xdr.hxx + ) + +flightgear_component(MultiPlayer "${SOURCES}" "${HEADERS}") \ No newline at end of file diff --git a/src/Network/CMakeLists.txt b/src/Network/CMakeLists.txt index 3f0e202c2..fa6643de8 100644 --- a/src/Network/CMakeLists.txt +++ b/src/Network/CMakeLists.txt @@ -27,8 +27,36 @@ set(SOURCES ray.cxx rul.cxx ) - -flightgear_component(Network "${SOURCES}") + +set(HEADERS + ATC-Inputs.hxx + ATC-Main.hxx + ATC-Outputs.hxx + AV400.hxx + AV400Sim.hxx + AV400WSim.hxx + atlas.hxx + garmin.hxx + generic.hxx + httpd.hxx + joyclient.hxx + jpg-httpd.hxx + jsclient.hxx + lfsglass.hxx + native.hxx + native_ctrls.hxx + native_fdm.hxx + native_gui.hxx + nmea.hxx + opengc.hxx + props.hxx + protocol.hxx + pve.hxx + ray.hxx + rul.hxx + ) + +flightgear_component(Network "${SOURCES}" "${HEADERS}") if(RTI_FOUND) add_subdirectory(HLA) diff --git a/src/Scenery/CMakeLists.txt b/src/Scenery/CMakeLists.txt index 162ab197e..bb85fc0e6 100644 --- a/src/Scenery/CMakeLists.txt +++ b/src/Scenery/CMakeLists.txt @@ -6,6 +6,13 @@ set(SOURCES scenery.cxx tilemgr.cxx ) - -flightgear_component(Scenery "${SOURCES}") + +set(HEADERS + SceneryPager.hxx + redout.hxx + scenery.hxx + tilemgr.hxx + ) + +flightgear_component(Scenery "${SOURCES}" "${HEADERS}") diff --git a/src/Scripting/CMakeLists.txt b/src/Scripting/CMakeLists.txt index 42f0dcfe8..e5f0fcfa3 100644 --- a/src/Scripting/CMakeLists.txt +++ b/src/Scripting/CMakeLists.txt @@ -4,6 +4,11 @@ set(SOURCES NasalSys.cxx nasal-props.cxx ) - -flightgear_component(Scripting "${SOURCES}") + +set(HEADERS + NasalSys.hxx + ) + + +flightgear_component(Scripting "${SOURCES}" "${HEADERS}") diff --git a/src/Sound/CMakeLists.txt b/src/Sound/CMakeLists.txt index f14728762..29a1d4854 100644 --- a/src/Sound/CMakeLists.txt +++ b/src/Sound/CMakeLists.txt @@ -8,5 +8,14 @@ set(SOURCES voice.cxx voiceplayer.cxx ) - -flightgear_component(Sound "${SOURCES}") \ No newline at end of file + +set(HEADERS + beacon.hxx + fg_fx.hxx + morse.hxx + sample_queue.hxx + voice.hxx + voiceplayer.hxx + ) + +flightgear_component(Sound "${SOURCES}" "${HEADERS}") \ No newline at end of file diff --git a/src/Systems/CMakeLists.txt b/src/Systems/CMakeLists.txt index dde27f258..bacc7efc3 100644 --- a/src/Systems/CMakeLists.txt +++ b/src/Systems/CMakeLists.txt @@ -7,5 +7,14 @@ set(SOURCES system_mgr.cxx vacuum.cxx ) + +set(HEADERS + electrical.hxx + pitot.hxx + static.hxx + system_mgr.hxx + vacuum.hxx + ) + -flightgear_component(Systems "${SOURCES}") \ No newline at end of file +flightgear_component(Systems "${SOURCES}" "${HEADERS}") \ No newline at end of file diff --git a/src/Time/CMakeLists.txt b/src/Time/CMakeLists.txt index f50c7a7ef..cdf26776e 100644 --- a/src/Time/CMakeLists.txt +++ b/src/Time/CMakeLists.txt @@ -6,4 +6,10 @@ set(SOURCES sunsolver.cxx ) -flightgear_component(Time "${SOURCES}") \ No newline at end of file +set(HEADERS + TimeManager.hxx + light.hxx + sunsolver.hxx + ) + +flightgear_component(Time "${SOURCES}" "${HEADERS}") \ No newline at end of file From 8f0f67f668e85db1213704b3815e3c8e98a68443 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Thu, 21 Jul 2011 15:46:29 +0200 Subject: [PATCH 34/36] Enable build of fgpanel by default in cmake --- CMakeLists.txt | 7 +++++++ utils/fgpanel/CMakeLists.txt | 1 + 2 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 429f22ff3..3f21c1645 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ option(ENABLE_JSBSIM "Set to ON to build FlightGear with JSBSim FDM" ON) option(ENABLE_FGADMIN "Set to ON to build FlightGear with FGADMIN" ON) option(EVENT_INPUT "Set to ON to build FlightGear with event-based Input support" OFF) option(ENABLE_LIBSVN "Set to ON to build FlightGear/terrasync with libsvnclient support" OFF) +option(WITH_FGPANEL "Set to ON to build the fgpanel application" ON) set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted") @@ -65,6 +66,12 @@ else() set(FG_NDEBUG 1) endif() +if(WITH_FGPANEL) + message(STATUS "Will build fgpanel") +else() + message(STATUS "Will NOT build fgpanel") +endif() + if(SP_FDMS) set(ENABLE_SP_FDM 1) endif() diff --git a/utils/fgpanel/CMakeLists.txt b/utils/fgpanel/CMakeLists.txt index 90dc2f2d9..65661273b 100644 --- a/utils/fgpanel/CMakeLists.txt +++ b/utils/fgpanel/CMakeLists.txt @@ -14,6 +14,7 @@ add_executable(fgpanel main.cxx panel_io.cxx) target_link_libraries(fgpanel + -lrt ${PNG_LIBRARIES} ${GLUT_LIBRARIES} ${SIMGEAR_LIBRARIES} From dcde3a9350e4d983c52a19801728d9d5b7b34a83 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Thu, 21 Jul 2011 23:42:45 +0200 Subject: [PATCH 35/36] Try to fix cmake build for fgpanel without GLUT --- CMakeLists.txt | 6 ----- utils/fgpanel/CMakeLists.txt | 43 ++++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f21c1645..364075f98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,12 +66,6 @@ else() set(FG_NDEBUG 1) endif() -if(WITH_FGPANEL) - message(STATUS "Will build fgpanel") -else() - message(STATUS "Will NOT build fgpanel") -endif() - if(SP_FDMS) set(ENABLE_SP_FDM 1) endif() diff --git a/utils/fgpanel/CMakeLists.txt b/utils/fgpanel/CMakeLists.txt index 65661273b..705fe92c7 100644 --- a/utils/fgpanel/CMakeLists.txt +++ b/utils/fgpanel/CMakeLists.txt @@ -2,25 +2,30 @@ find_package(PNG REQUIRED) find_package(OpenGL REQUIRED) find_package(GLUT REQUIRED) +if(GLUT_FOUND) + message(STATUS "found glut") -add_executable(fgpanel main.cxx - FGGLApplication.cxx - FGPanelApplication.cxx - FGPNGTextureLoader.cxx - FGRGBTextureLoader.cxx - FGPanelProtocol.cxx - FGFontCache.cxx - panel.cxx - panel_io.cxx) + add_executable(fgpanel main.cxx + FGGLApplication.cxx + FGPanelApplication.cxx + FGPNGTextureLoader.cxx + FGRGBTextureLoader.cxx + FGPanelProtocol.cxx + FGFontCache.cxx + panel.cxx + panel_io.cxx) -target_link_libraries(fgpanel - -lrt - ${PNG_LIBRARIES} - ${GLUT_LIBRARIES} - ${SIMGEAR_LIBRARIES} - ${OPENGL_LIBRARIES} - ${ZLIB_LIBRARIES} - ${PLIB_LIBRARIES} - ) + target_link_libraries(fgpanel + -lrt + ${PNG_LIBRARIES} + ${GLUT_LIBRARIES} + ${SIMGEAR_LIBRARIES} + ${OPENGL_LIBRARIES} + ${ZLIB_LIBRARIES} + ${PLIB_LIBRARIES} + ) -install(TARGETS fgpanel RUNTIME DESTINATION bin) + install(TARGETS fgpanel RUNTIME DESTINATION bin) +else() + message(STATUS "glut NOT found, can't build fgpanel") +endif() From 3723de56ca72320b79d8ab22e12e02b2dc11341d Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Fri, 22 Jul 2011 12:37:41 +0200 Subject: [PATCH 36/36] Experimental navinfo() Nasal extension function Add a navinfo() Nasal extension function to provide information about navaids. Inspired by the airportinfo function. This is work in progress, do not rely on this in your Nasal code - the interface might change over the next weeks. --- src/Scripting/NasalSys.cxx | 91 +++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 2 deletions(-) diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index e2bc88619..3d5bddb53 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -31,9 +31,10 @@ #include
#include
#include -#include +#include #include + #include "NasalSys.hxx" static FGNasalSys* nasalSys = 0; @@ -695,6 +696,91 @@ static naRef f_airportinfo(naContext c, naRef me, int argc, naRef* args) } +// Returns vector of data hash for navaid of a , nil on error +// navaids sorted by ascending distance +// navinfo([,],[],[]) +// lat/lon (numeric): use latitude/longitude instead of ac position +// type: ("fix"|"vor"|"ndb"|"ils"|"dme"|"tacan"|"any") +// id: (partial) id of the fix +// examples: +// navinfo("vor") returns all vors +// navinfo("HAM") return all navaids who's name start with "HAM" +// navinfo("vor", "HAM") return all vor who's name start with "HAM" +//navinfo(34,48,"vor","HAM") return all vor who's name start with "HAM" +// sorted by distance relative to lat=34, lon=48 +static naRef f_navinfo(naContext c, naRef me, int argc, naRef* args) +{ + static SGConstPropertyNode_ptr latn = fgGetNode("/position/latitude-deg", true); + static SGConstPropertyNode_ptr lonn = fgGetNode("/position/longitude-deg", true); + SGGeod pos; + + if(argc >= 2 && naIsNum(args[0]) && naIsNum(args[1])) { + pos = SGGeod::fromDeg(args[1].num, args[0].num); + args += 2; + argc -= 2; + } else { + pos = SGGeod::fromDeg(lonn->getDoubleValue(), latn->getDoubleValue()); + } + + FGPositioned::Type type = FGPositioned::INVALID; + nav_list_type navlist; + const char * id = ""; + + if(argc > 0 && naIsString(args[0])) { + const char *s = naStr_data(args[0]); + if(!strcmp(s, "any")) type = FGPositioned::INVALID; + else if(!strcmp(s, "fix")) type = FGPositioned::FIX; + else if(!strcmp(s, "vor")) type = FGPositioned::VOR; + else if(!strcmp(s, "ndb")) type = FGPositioned::NDB; + else if(!strcmp(s, "ils")) type = FGPositioned::ILS; + else if(!strcmp(s, "dme")) type = FGPositioned::DME; + else if(!strcmp(s, "tacan")) type = FGPositioned::TACAN; + else id = s; // this is an id + ++args; + --argc; + } + + if(argc > 0 && naIsString(args[0])) { + if( *id != 0 ) { + naRuntimeError(c, "navinfo() called with navaid id"); + return naNil(); + } + id = naStr_data(args[0]); + ++args; + --argc; + } + + if( argc > 0 ) { + naRuntimeError(c, "navinfo() called with too many arguments"); + return naNil(); + } + + navlist = globals->get_navlist()->findByIdentAndFreq( pos, id, 0.0, type ); + + naRef reply = naNewVector(c); + for( nav_list_type::const_iterator it = navlist.begin(); it != navlist.end(); ++it ) { + const FGNavRecord * nav = *it; + + // set navdata hash + naRef navdata = naNewHash(c); +#define HASHSET(s,l,n) naHash_set(navdata, naStr_fromdata(naNewString(c),s,l),n) + HASHSET("id", 2, naStr_fromdata(naNewString(c), + const_cast(nav->ident().c_str()), nav->ident().length())); + HASHSET("name", 4, naStr_fromdata(naNewString(c), + const_cast(nav->name().c_str()), nav->name().length())); + HASHSET("lat", 3, naNum(nav->get_lat())); + HASHSET("lon", 3, naNum(nav->get_lon())); + HASHSET("elevation", 9, naNum(nav->get_elev_ft() * SG_FEET_TO_METER)); + HASHSET("type", 4, naStr_fromdata(naNewString(c), + const_cast(nav->nameForType(nav->type())), strlen(nav->nameForType(nav->type())))); + HASHSET("distance", 8, naNum(SGGeodesy::distanceNm( pos, nav->geod() ) * SG_NM_TO_METER ) ); + HASHSET("bearing", 7, naNum(SGGeodesy::courseDeg( pos, nav->geod() ) ) ); +#undef HASHSET + naVec_append( reply, navdata ); + } + return reply; +} + // Table of extension functions. Terminate with zeros. static struct { const char* name; naCFunction func; } funcs[] = { { "getprop", f_getprop }, @@ -717,6 +803,7 @@ static struct { const char* name; naCFunction func; } funcs[] = { { "geodtocart", f_geodtocart }, { "geodinfo", f_geodinfo }, { "airportinfo", f_airportinfo }, + { "navinfo", f_navinfo }, { 0, 0 } }; @@ -1139,7 +1226,7 @@ naRef FGNasalSys::setListener(naContext c, int argc, naRef* args) FGNasalListener *nl = new FGNasalListener(node, code, this, gcSave(code), _listenerId, init, type); - node->addChangeListener(nl, init); + node->addChangeListener(nl, init != 0); _listener[_listenerId] = nl; return naNum(_listenerId++);