]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/simple.cxx
- Added ultra-light traffic is now a separate traffic class that can have its
[flightgear.git] / src / Airports / simple.cxx
index cf969de1ff60232eed7357c1699a3f4d005e02b0..64c2109b11187927aecbdd3e632597bdfc7973da 100644 (file)
@@ -50,6 +50,7 @@
 #include STL_STRING
 
 #include "simple.hxx"
+#include "xmlloader.hxx"
 
 SG_USING_STD(sort);
 SG_USING_STD(random_shuffle);
@@ -89,44 +90,14 @@ FGAirportDynamics * FGAirport::getDynamics()
     if (dynamics != 0) {
         return dynamics;
     } else {
-        FGRunwayPreference rwyPrefs;
         //cerr << "Trying to load dynamics for " << _id << endl;
-        dynamics = new FGAirportDynamics(_latitude, _longitude, _elevation, _id);
-
-        SGPath parkpath( globals->get_fg_root() );
-        parkpath.append( "/Airports/AI/" );
-        parkpath.append(_id);
-        parkpath.append("parking.xml");
-
-        SGPath rwyPrefPath( globals->get_fg_root() );
-        rwyPrefPath.append( "/Airports/AI/" );
-        rwyPrefPath.append(_id);
-        rwyPrefPath.append("rwyuse.xml");
-
-        //if (ai_dirs.find(id.c_str()) != ai_dirs.end()
-        //  && parkpath.exists())
-        if (parkpath.exists()) {
-            try {
-                readXML(parkpath.str(),*dynamics);
-                dynamics->init();
-            } catch (const sg_exception &e) {
-                //cerr << "unable to read " << parkpath.str() << endl;
-            }
-        }
+        dynamics = new FGAirportDynamics(this);
+        XMLLoader::load(dynamics);
 
-        //if (ai_dirs.find(id.c_str()) != ai_dirs.end()
-        //  && rwyPrefPath.exists())
-        if (rwyPrefPath.exists()) {
-            try {
-                readXML(rwyPrefPath.str(), rwyPrefs);
-                dynamics->setRwyUse(rwyPrefs);
-            } catch (const sg_exception &e) {
-                //cerr << "unable to read " << rwyPrefPath.str() << endl;
-                //exit(1);
-            }
-        }
-        //exit(1);
-    }
+        FGRunwayPreference rwyPrefs(this);
+        XMLLoader::load(&rwyPrefs);
+        dynamics->setRwyUse(rwyPrefs);
+   }
     return dynamics;
 }
 
@@ -176,7 +147,6 @@ void FGAirportList::add( const string &id, const double longitude,
                          const double latitude, const double elevation,
                          const string &name, const bool has_metar )
 {
-    FGRunwayPreference rwyPrefs;
     FGAirport* a = new FGAirport(id, longitude, latitude, elevation, name, has_metar);
 
     airports_by_id[a->getId()] = a;