+/**
+ * return blank-separated string of waypoints
+ */
+const char *
+FGAutopilot::getAPwaypoint () const
+{
+ static char wplist[500];
+ char *p = wplist;
+ int WPListsize, i;
+
+ // FIXME: This can cause a possible buffer overflow, EMH
+ if ( globals->get_route()->size() > 0 ) {
+ WPListsize = globals->get_route()->size();
+
+ for (i = 0; i < globals->get_route()->size(); i++ ) {
+ p += sprintf(p, "%5s ",
+ globals->get_route()->get_waypoint(i).get_id().c_str() );
+ }
+ return wplist;
+
+ } else {
+ return "none specified";
+ }
+}
+
+
+/**
+ * set next waypoint (if str='0', then delete next(first) waypoint)
+ */
+void
+FGAutopilot::setAPwaypoint (const char * apt)
+{
+ if (strcmp(apt, "0")==0)
+ {
+ SG_LOG( SG_AUTOPILOT, SG_INFO, "delete of first wp" );
+ if ( globals->get_route()->size() )
+ globals->get_route()->delete_first();
+ return;
+ }
+
+ if ( NewWaypoint( apt ) == 0)
+ SG_LOG( SG_AUTOPILOT, SG_INFO, "Waypoint " << apt << "not in d.b." );
+ else
+ {
+ /* SG_LOG( SG_AUTOPILOT, SG_INFO, "GOOD!" ); */
+ }
+}
+