+ }
+ } else {
+ loadAirportXMLDataIntoVisitor(p->getId(), "rwyuse", visitor);
+ }
+}
+
+void XMLLoader::load(FGSidStar* p) {
+ SGPath path;
+ if (findAirportData(p->getId(), "SID", path)) {
+ p->load(path);
+ }
+}
+
+bool XMLLoader::findAirportData(const std::string& aICAO,
+ const std::string& aFileName, SGPath& aPath)
+{
+ string_list sc = globals->get_fg_scenery();
+ char buffer[128];
+ ::snprintf(buffer, 128, "%c/%c/%c/%s.%s.xml",
+ aICAO[0], aICAO[1], aICAO[2],
+ aICAO.c_str(), aFileName.c_str());
+
+ for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) {
+ SGPath path(*it);
+ path.append("Airports");
+ path.append(string(buffer));
+ if (path.exists()) {
+ aPath = path;
+ return true;
+ } // of path exists
+ } // of scenery path iteration
+ return false;
+}
+
+bool XMLLoader::loadAirportXMLDataIntoVisitor(const string& aICAO,
+ const string& aFileName, XMLVisitor& aVisitor)
+{
+ SGPath path;
+ if (!findAirportData(aICAO, aFileName, path)) {
+ SG_LOG(SG_GENERAL, SG_DEBUG, "loadAirportXMLDataIntoVisitor: failed to find data for " << aICAO << "/" << aFileName);
+ return false;
+ }
+
+ SG_LOG(SG_GENERAL, SG_DEBUG, "loadAirportXMLDataIntoVisitor: loading from " << path.str());
+ readXML(path.str(), aVisitor);
+ return true;