]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/simple.cxx
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / Airports / simple.cxx
index f563cf1d0a72ab1a113a9af6cdc06c6ae8036447..a085fab57ab7804084100bb8cea4983decb7672a 100644 (file)
@@ -143,7 +143,10 @@ FGRunway* FGAirport::getRunwayByIdent(const string& aIdent) const
 
 FGAirport::Runway_iterator
 FGAirport::getIteratorForRunwayIdent(const string& aIdent) const
-{ 
+{
+  if (aIdent.empty())
+    return mRunways.end();
+
   loadRunways();
   
   string ident(aIdent);
@@ -369,7 +372,7 @@ void FGAirport::loadRunways() const
   }
   
   mRunwaysLoaded = true;
-  loadSceneryDefintions();
+  loadSceneryDefinitions();
 }
 
 void FGAirport::loadTaxiways() const
@@ -396,7 +399,7 @@ void FGAirport::loadProcedures() const
   Route::loadAirportProcedures(path, const_cast<FGAirport*>(this));
 }
 
-void FGAirport::loadSceneryDefintions() const
+void FGAirport::loadSceneryDefinitions() const
 {  
   // allow users to disable the scenery data in the short-term
   // longer term, this option can probably disappear
@@ -453,9 +456,13 @@ void FGAirport::readTowerData(SGPropertyNode* aRoot)
   SGPropertyNode* twrNode = aRoot->getChild("tower")->getChild("twr");
   double lat = twrNode->getDoubleValue("lat"), 
     lon = twrNode->getDoubleValue("lon"), 
-    elevM = twrNode->getDoubleValue("elev-m");
-    
-  _tower_location = SGGeod::fromDegM(lon, lat, elevM);
+    elevM = twrNode->getDoubleValue("elev-m");  
+// tower elevation is AGL, not AMSL. Since we don't want to depend on the
+// scenery for a precise terrain elevation, we use the field elevation
+// (this is also what the apt.dat code does)
+  double fieldElevationM = geod().getElevationM();
+  
+  _tower_location = SGGeod::fromDegM(lon, lat, fieldElevationM + elevM);
 }
 
 bool FGAirport::buildApproach(Waypt* aEnroute, STAR* aSTAR, FGRunway* aRwy, WayptVec& aRoute)
@@ -511,13 +518,13 @@ bool FGAirport::buildApproach(Waypt* aEnroute, STAR* aSTAR, FGRunway* aRwy, Wayp
   return aps.front()->routeFromVectors(aRoute);
 }
 
-pair<SID*, WayptRef>
+pair<flightgear::SID*, WayptRef>
 FGAirport::selectSID(const SGGeod& aDest, FGRunway* aRwy)
 {
   loadProcedures();
   
   WayptRef enroute;
-  SID* sid = NULL;
+  flightgear::SID* sid = NULL;
   double d = 1e9;
   
   for (unsigned int i=0; i<mSIDs.size(); ++i) {
@@ -580,7 +587,7 @@ FGAirport::selectSTAR(const SGGeod& aOrigin, FGRunway* aRwy)
 }
 
 
-void FGAirport::addSID(SID* aSid)
+void FGAirport::addSID(flightgear::SID* aSid)
 {
   mSIDs.push_back(aSid);
 }
@@ -601,13 +608,13 @@ unsigned int FGAirport::numSIDs() const
   return mSIDs.size();
 }
 
-SID* FGAirport::getSIDByIndex(unsigned int aIndex) const
+flightgear::SID* FGAirport::getSIDByIndex(unsigned int aIndex) const
 {
   loadProcedures();
   return mSIDs[aIndex];
 }
 
-SID* FGAirport::findSIDWithIdent(const std::string& aIdent) const
+flightgear::SID* FGAirport::findSIDWithIdent(const std::string& aIdent) const
 {
   loadProcedures();
   for (unsigned int i=0; i<mSIDs.size(); ++i) {