#include <Navaids/procedure.hxx>
#include <Navaids/waypoint.hxx>
#include <Navaids/LevelDXML.hxx>
-#include <Airports/simple.hxx>
+#include <Airports/airport.hxx>
using std::string;
using std::vector;
void Waypt::setFlag(WayptFlag aFlag, bool aV)
{
+ if (aFlag == 0) {
+ throw sg_range_exception("invalid waypoint flag set");
+ }
+
_flags = (_flags & ~aFlag);
if (aV) _flags |= aFlag;
}
"Waypt::createFromProperties");
}
- WayptRef nd(createInstance(aOwner, aProp->getStringValue("type")));
+ try {
+ WayptRef nd(createInstance(aOwner, aProp->getStringValue("type")));
+ nd->initFromProperties(aProp);
+ return nd;
+ } catch (sg_exception& e) {
+ SG_LOG(SG_GENERAL, SG_WARN, "failed to create waypoint, trying basic:" << e.getMessage());
+ }
+
+// if we failed to make the waypoint, try again making a basic waypoint.
+// this handles the case where a navaid waypoint is missing, for example
+ WayptRef nd(new BasicWaypt(aOwner));
nd->initFromProperties(aProp);
return nd;
}
std::fstream f;
f.open(p.str().c_str(), fstream::out | fstream::app);
if (!f.is_open()) {
- SG_LOG(SG_GENERAL, SG_WARN, "unable to open:" << p.str());
+ SG_LOG(SG_NAVAID, SG_WARN, "unable to open:" << p.str());
return;
}
NavdataVisitor visitor(aApt, aPath);
readXML(aPath.str(), visitor);
} catch (sg_io_exception& ex) {
- SG_LOG(SG_GENERAL, SG_WARN, "failure parsing procedures: " << aPath.str() <<
+ SG_LOG(SG_NAVAID, SG_WARN, "failure parsing procedures: " << aPath.str() <<
"\n\t" << ex.getMessage() << "\n\tat:" << ex.getLocation().asString());
} catch (sg_exception& ex) {
- SG_LOG(SG_GENERAL, SG_WARN, "failure parsing procedures: " << aPath.str() <<
+ SG_LOG(SG_NAVAID, SG_WARN, "failure parsing procedures: " << aPath.str() <<
"\n\t" << ex.getMessage());
}
}