1 // This program is free software; you can redistribute it and/or
2 // modify it under the terms of the GNU General Public License as
3 // published by the Free Software Foundation; either version 2 of the
4 // License, or (at your option) any later version.
6 // This program is distributed in the hope that it will be useful, but
7 // WITHOUT ANY WARRANTY; without even the implied warranty of
8 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 // General Public License for more details.
11 // You should have received a copy of the GNU General Public License
12 // along with this program; if not, write to the Free Software
13 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #include <simgear/misc/sg_path.hxx>
17 #include <Main/globals.hxx>
19 #include "xmlloader.hxx"
20 #include "dynamicloader.hxx"
21 #include "runwayprefloader.hxx"
23 #include "dynamics.hxx"
24 #include "runwayprefs.hxx"
26 XMLLoader::XMLLoader() {}
27 XMLLoader::~XMLLoader() {}
29 void XMLLoader::load(FGAirportDynamics* d) {
30 FGAirportDynamicsXMLLoader visitor(d);
32 SGPath parkpath( globals->get_fg_root() );
33 parkpath.append( "/AI/Airports/" );
34 parkpath.append( d->getId() );
35 parkpath.append( "parking.xml" );
37 if (parkpath.exists()) {
39 readXML(parkpath.str(), visitor);
41 } catch (const sg_exception &e) {
42 //cerr << "unable to read " << parkpath.str() << endl;
48 void XMLLoader::load(FGRunwayPreference* p) {
49 FGRunwayPreferenceXMLLoader visitor(p);
51 SGPath rwyPrefPath( globals->get_fg_root() );
52 rwyPrefPath.append( "AI/Airports/" );
53 rwyPrefPath.append( p->getId() );
54 rwyPrefPath.append( "rwyuse.xml" );
56 //if (ai_dirs.find(id.c_str()) != ai_dirs.end()
57 // && rwyPrefPath.exists())
58 if (rwyPrefPath.exists()) {
60 readXML(rwyPrefPath.str(), visitor);
61 } catch (const sg_exception &e) {
62 //cerr << "unable to read " << rwyPrefPath.str() << endl;