Exemple #1
0
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;
}
Exemple #2
0
bool
TaskAutoPilot::far_from_target(const TaskAccessor& task, const AIRCRAFT_STATE& state)
{
  // are we considered close to the target?

  if (task.is_empty())
    return w[0].distance(state.Location)>state.Speed;

  bool d_far = (task.leg_stats().remaining.get_distance() > fixed(100));

  if (!task.is_ordered())
    // cheat for non-ordered tasks
    return d_far;

  bool entered = 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.Speed);
  }
  return (dc>state.Speed) || !entered;
}