]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/xmlloader.cxx
testair.cxx is a 21 lines long, obsolete test application. After removing
[flightgear.git] / src / Airports / xmlloader.cxx
index 440d7718fa7c33934a876f75c849b0a4a08c225a..7005ca52a72a6fa28b157bf0626d6652659d73d2 100644 (file)
@@ -29,11 +29,11 @@ XMLLoader::XMLLoader() {}
 XMLLoader::~XMLLoader() {}
 
 string XMLLoader::expandICAODirs(const string in){
-     cerr << "Expanding " << in << endl;
+     //cerr << "Expanding " << in << endl;
      if (in.size() == 4) {
           char buffer[11];
           snprintf(buffer, 11, "%c/%c/%c", in[0], in[1], in[2]);
-          cerr << "result: " << buffer << endl;
+          //cerr << "result: " << buffer << endl;
           return string(buffer);
      } else {
            return in;
@@ -48,6 +48,7 @@ void XMLLoader::load(FGAirportDynamics* d) {
        parkpath.append( "/AI/Airports/" );
        parkpath.append( d->getId() );
        parkpath.append( "parking.xml" );
+       SG_LOG(SG_GENERAL, SG_DEBUG, "running old loader:" << parkpath.c_str());
        if (parkpath.exists()) {
            try {
                readXML(parkpath.str(), visitor);
@@ -55,25 +56,27 @@ void XMLLoader::load(FGAirportDynamics* d) {
            } 
            catch (const sg_exception &e) {
            }
-       } else {
-            string_list sc = globals->get_fg_scenery();
-            char buffer[32];
-            snprintf(buffer, 32, "%s.groundnet.xml", d->getId().c_str() );
-            string airportDir = XMLLoader::expandICAODirs(d->getId());
-            for (string_list_iterator i = sc.begin(); i != sc.end(); i++) {
-                SGPath parkpath( *i );
-                parkpath.append( "Airports" );
-                parkpath.append ( airportDir );
-                parkpath.append( string (buffer) );
-                if (parkpath.exists()) {
-                    try {
-                        readXML(parkpath.str(), visitor);
-                        d->init();
-                    } 
-                    catch (const sg_exception &e) {
-                    }
-                    return;
+       }
+    } else {
+        string_list sc = globals->get_fg_scenery();
+        char buffer[32];
+        snprintf(buffer, 32, "%s.groundnet.xml", d->getId().c_str() );
+        string airportDir = XMLLoader::expandICAODirs(d->getId());
+        for (string_list_iterator i = sc.begin(); i != sc.end(); i++) {
+            SGPath parkpath( *i );
+            parkpath.append( "Airports" );
+            parkpath.append ( airportDir );
+            parkpath.append( string (buffer) );
+            SG_LOG(SG_GENERAL, SG_DEBUG, "Trying to read ground net:" << parkpath.c_str());
+            if (parkpath.exists()) {
+                SG_LOG(SG_GENERAL, SG_DEBUG, "reading ground net:" << parkpath.c_str());
+                try {
+                    readXML(parkpath.str(), visitor);
+                    d->init();
+                } 
+                catch (const sg_exception &e) {
                 }
+                return;
             }
         }
     }
@@ -115,3 +118,28 @@ void XMLLoader::load(FGRunwayPreference* p) {
     }
 }
 
+void XMLLoader::load(FGSidStar* p) {
+    //FGRunwayPreferenceXMLLoader visitor(p);
+    if (fgGetBool("/sim/traffic-manager/use-custom-scenery-data") == true) {
+       string_list sc = globals->get_fg_scenery();
+       char buffer[32];
+       snprintf(buffer, 32, "%s.SID.xml", p->getId().c_str() );
+       string airportDir = expandICAODirs(p->getId());
+       for (string_list_iterator i = sc.begin(); i != sc.end(); i++) {
+           SGPath sidpath( *i );
+           sidpath.append( "Airports" );
+           sidpath.append ( airportDir );
+           sidpath.append( string(buffer) );
+           if (sidpath.exists()) {
+               try {
+                   //readXML(rwypath.str(), visitor);
+                   //cerr << "Reading SID procedure : " << sidpath.str() << endl;
+                   p->load(sidpath);
+                } 
+                catch (const sg_exception &e) {
+                }
+                return;
+            }
+        }
+    }
+}