Пример #1
0
	void StateManager::dropState()
	{
		if(!isEmpty())
		{
			// Move ownership and drop the active State to the bottom
			getActiveState()->pause();
			m_stack.insert(m_stack.begin(), std::move(m_stack.back()));

			// Ownership has been moved, delete stack element
			m_stack.pop_back();
			getActiveState()->resume();
		}
	}
Пример #2
0
	void StateManager::pushState(std::unique_ptr<State> state)
	{
		// Pause active state, if there is one
		if(!isEmpty())
			getActiveState()->pause();

		m_stack.push_back(std::move(state));
	}
Пример #3
0
bool 
AATPoint::update_sample(const AIRCRAFT_STATE& state,
                        TaskEvents &task_events) 
{
  bool retval = OrderedTaskPoint::update_sample(state,task_events);
  if ((getActiveState() == CURRENT_ACTIVE) && (!m_target_locked)) {
    retval |= check_target(state);
  }

  return retval;
}
Пример #4
0
const GeoPoint&
AATPoint::get_location_remaining() const
{
  if (getActiveState() == BEFORE_ACTIVE) {
    if (has_sampled()) {
      return get_location_max();
    } else {
      return get_location_min();
    }
  } else {
    return m_target_location;
  }
}
Пример #5
0
bool
AATPoint::check_target(const AIRCRAFT_STATE& state, const bool known_outside) 
{
  if ((getActiveState() == CURRENT_ACTIVE) && (m_target_locked)) {
    return false;
  }
  bool moved = false;
  if (!known_outside && isInSector(state)) {
    moved = check_target_inside(state);
  } else {
    moved = check_target_outside(state);
  }

  return moved;
}
Пример #6
0
bool
AATPoint::set_range(const fixed p, const bool force_if_current)
{
  if (m_target_locked) {
    return false;
  }

  switch (getActiveState()) {
  case CURRENT_ACTIVE:
    if (!has_entered() || force_if_current) {
      m_target_location = get_location_min().interpolate(get_location_max(),p);
      return true;
    }
    return false;
  case AFTER_ACTIVE:
    if (getActiveState() == AFTER_ACTIVE) {
      m_target_location = get_location_min().interpolate(get_location_max(),p);
      return true;
    }
  default:
    return false;
  }
  return false;
}