예제 #1
0
OrderedTask* 
TaskFileXCSoar::GetTask(const Waypoints *waypoints, unsigned index) const
{
  assert(index == 0);

  if (protected_task_manager == NULL)
    return NULL;

  DataNode* root = DataNodeXML::load(path);
  if (!root)
    return NULL;

  if (_tcscmp(root->get_name().c_str(),_T("Task")) == 0) {
    OrderedTask* task = protected_task_manager->task_blank();
    Deserialiser des(*root, waypoints);
    des.deserialise(*task);
    if (task->check_task()) {
      delete root;
      return task;
    }
    delete task;
    delete root;
    return NULL;
  }
  delete root;
  return NULL;
}