bool TaskAutoPilot::far_from_target(const TaskAccessor& task, const AircraftState& state) { // are we considered close to the target? if (task.is_empty() || !task.leg_stats().remaining.IsDefined()) return w[0].Distance(state.location)>state.ground_speed; bool d_far = (task.leg_stats().remaining.GetDistance() > fixed(100)); if (!task.is_ordered()) // cheat for non-ordered tasks return d_far; bool entered = awp >= task.size() || task.has_entered(awp); if (current_has_target(task)) return d_far || !entered; fixed dc = w[0].Distance(state.location); if (awp==0) { return (dc>state.ground_speed); } return (dc>state.ground_speed) || !entered; }
bool TaskAutoPilot::has_finished(TaskAccessor& task) { if (task.is_finished()) return true; if (task.is_ordered()) { return awp>= task.size(); } else { return awp>= 1; } }