#include STL_STRING
#include "simple.hxx"
+#include "xmlloader.hxx"
SG_USING_STD(sort);
SG_USING_STD(random_shuffle);
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;
}
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;