]> git.mxchange.org Git - flightgear.git/blob - src/Airports/xmlloader.cxx
Thomas Foerster:
[flightgear.git] / src / Airports / xmlloader.cxx
1 #include <simgear/misc/sg_path.hxx>
2 #include <Main/globals.hxx>
3
4 #include "xmlloader.hxx"
5 #include "dynamicloader.hxx"
6 #include "runwayprefloader.hxx"
7
8 #include "dynamics.hxx"
9 #include "runwayprefs.hxx"
10
11 XMLLoader::XMLLoader() {}
12 XMLLoader::~XMLLoader() {}
13
14 void XMLLoader::load(FGAirportDynamics* d) {
15   FGAirportDynamicsXMLLoader visitor(d);
16
17   SGPath parkpath( globals->get_fg_root() );
18   parkpath.append( "/AI/Airports/" );
19   parkpath.append( d->getId() );
20   parkpath.append( "parking.xml" );
21   
22   if (parkpath.exists()) {
23     try {
24       readXML(parkpath.str(), visitor);
25       d->init();
26     } catch (const sg_exception &e) {
27       //cerr << "unable to read " << parkpath.str() << endl;
28     }
29   }
30
31 }
32
33 void XMLLoader::load(FGRunwayPreference* p) {
34   FGRunwayPreferenceXMLLoader visitor(p);
35
36   SGPath rwyPrefPath( globals->get_fg_root() );
37   rwyPrefPath.append( "AI/Airports/" );
38   rwyPrefPath.append( p->getId() );
39   rwyPrefPath.append( "rwyuse.xml" );
40
41   //if (ai_dirs.find(id.c_str()) != ai_dirs.end()
42   //  && rwyPrefPath.exists())
43   if (rwyPrefPath.exists()) {
44     try {
45       readXML(rwyPrefPath.str(), visitor);
46     } catch (const sg_exception &e) {
47       //cerr << "unable to read " << rwyPrefPath.str() << endl;
48     }
49   }
50 }