SGWayPoint* FGRouteMgr::make_waypoint(const string& tgt ) {
string target(boost::to_upper_copy(tgt));
- // extract altitude
- double alt = cruise->getDoubleValue("altitude-ft") * SG_FEET_TO_METER;
+ double alt = -9999.0;
+ // extract altitude
size_t pos = target.find( '@' );
if ( pos != string::npos ) {
alt = atof( target.c_str() + pos + 1 );
bool FGRouteMgr::activate()
{
- if (_departure) {
+ if (isRouteActive()) {
+ SG_LOG(SG_AUTOPILOT, SG_WARN, "duplicate route-activation, no-op");
+ return false;
+ }
+
+ // only add departure waypoint if we're not airborne, so that
+ // in-air route activation doesn't confuse matters.
+ if (weightOnWheels->getBoolValue() && _departure) {
string runwayId(departure->getStringValue("runway"));
FGRunway* runway = NULL;
if (_departure->hasRunwayWithIdent(runwayId)) {