- void add_waypoint( const SGWayPoint &wp, int n = -1 ) {
- if ( n < 0 || n >= (int)route.size() )
- route.push_back( wp );
- else
- route.insert( route.begin() + n, 1, wp );
-
- int size = route.size();
- if ( size > 1 ) {
- SGWayPoint next_to_last = route[ size - 2 ];
- double tmpd, tmpc;
- wp.CourseAndDistance( next_to_last, &tmpc, &tmpd );
- route[size - 1].set_distance( tmpd );
- }
- }
-