From ce084ab1c5358adfcd456d85b9c6ac290c4594ba Mon Sep 17 00:00:00 2001 From: durk Date: Sun, 30 Aug 2009 14:39:04 +0000 Subject: [PATCH] Two minor (codewise) fixes to ensure everything works as advertised: - Make sure to initialize the groundnetwork after succesful loading. - Ensure that the AI groundnetwork code proximity detection code used the correct values for bearing. (Note that detecting the proximity of the user aircraft appears still to be broken. I'll look into that later). --- src/Airports/dynamicloader.cxx | 2 +- src/Airports/groundnetwork.cxx | 4 ++-- src/Airports/xmlloader.cxx | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Airports/dynamicloader.cxx b/src/Airports/dynamicloader.cxx index 10cc253ba..7da29ae73 100644 --- a/src/Airports/dynamicloader.cxx +++ b/src/Airports/dynamicloader.cxx @@ -25,7 +25,7 @@ FGAirportDynamicsXMLLoader::FGAirportDynamicsXMLLoader(FGAirportDynamics* dyn): XMLVisitor(), _dynamics(dyn) {} void FGAirportDynamicsXMLLoader::startXML () { - //cout << "Start XML" << endl; + //cout << "FGAirportDynamicsLoader::Start XML" << endl; } void FGAirportDynamicsXMLLoader::endXML () { diff --git a/src/Airports/groundnetwork.cxx b/src/Airports/groundnetwork.cxx index f1e0e086f..8bdd947fc 100644 --- a/src/Airports/groundnetwork.cxx +++ b/src/Airports/groundnetwork.cxx @@ -606,7 +606,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat, SGGeod other(SGGeod::fromDegM(i->getLongitude(), i->getLatitude(), i->getAltitude())); - SGGeodesy::inverse(other, curr, course, az2, dist); + SGGeodesy::inverse(curr, other, course, az2, dist); bearing = fabs(heading-course); if (bearing > 180) bearing = 360-bearing; @@ -626,7 +626,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat, //cerr << "Comparing " << current->getId() << " and " << i->getId() << endl; SGGeod other(SGGeod::fromDegM(i->getLongitude(), i->getLatitude(), i->getAltitude())); - SGGeodesy::inverse(other, curr, course, az2, dist); + SGGeodesy::inverse(curr, other, course, az2, dist); bearing = fabs(heading-course); if (bearing > 180) bearing = 360-bearing; diff --git a/src/Airports/xmlloader.cxx b/src/Airports/xmlloader.cxx index 58539a1f2..7579e8cc4 100644 --- a/src/Airports/xmlloader.cxx +++ b/src/Airports/xmlloader.cxx @@ -49,7 +49,9 @@ void XMLLoader::load(FGAirportDynamics* d) { } } } else { - loadAirportXMLDataIntoVisitor(d->getId(), "groundnet", visitor); + if(loadAirportXMLDataIntoVisitor(d->getId(), "groundnet", visitor)) { + d->init(); + } } }