- SG_LOG(SG_AUTOPILOT, SG_INFO, "reached end of active route");
- _finished->fireValueChanged();
- active->setBoolValue(false);
- return true;
+// also done if we hit the final waypoint
+ if (_plan->currentIndex() >= _plan->numLegs()) {
+ done = true;
+ }
+
+ if (done) {
+ SG_LOG(SG_AUTOPILOT, SG_INFO, "reached end of active route");
+ _finished->fireValueChanged();
+ active->setBoolValue(false);
+ }
+
+ return done;