当前位置: 首页>>代码示例>>C++>>正文


C++ Condition::addDependency方法代码示例

本文整理汇总了C++中Condition::addDependency方法的典型用法代码示例。如果您正苦于以下问题:C++ Condition::addDependency方法的具体用法?C++ Condition::addDependency怎么用?C++ Condition::addDependency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Condition的用法示例。


在下文中一共展示了Condition::addDependency方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateObjective

void ConditionManager::updateObjective(int id, int index, int wccond)
{
    const ConditionEntry &entry = condEntries.at(id);
    ConditionEvent *condSuccess = NULL;
    ConditionEvent *condFailure = NULL;
    switch (wccond)
    {
    case 1:
        condSuccess = entry.condTrigger;
        break;
    case 2:
        condSuccess = entry.condSignal;
        break;
    case 3:
        condSuccess = entry.condAttacked;
        break;
    case 4:
        condSuccess = entry.condIdentified;
        break;
    case 5:
        condFailure = entry.condSignal;
        break;
    case 6:
        condSuccess = entry.condParalyzed;
        condFailure = entry.condSignal;
        break;
    case 7:
        condSuccess = entry.condFinished;
        condFailure = entry.condSignal;
        break;
    case 8:
        condSuccess = entry.condBoarded;
        condFailure = entry.condSignal;
        break;
    case 9:
        condSuccess = entry.condSignal;
        condFailure = entry.condSignal;
        break;
    default:
        util::Debug() << "Unhandled objective condition " << id << " " << wccond;
    }
    if (condSuccess == NULL && condFailure == NULL)
        util::Debug() << "Unachievable objective " << id << " " << index;

    Condition *cond;
    if (condSuccess != NULL)
    {
        int objective = index*2;
        if (m_condObjectives.find(objective) == m_condObjectives.end())
        {
            cond = &m_condObjectives.emplace(std::piecewise_construct,
                std::forward_as_tuple(objective),
                std::forward_as_tuple(m_scenario, 1)).first->second;
            if (objective < 16)
            {
                cond->addDependency(&m_condSuccess);
                m_condSuccess.setLimit(m_condSuccess.limit() + 1);
            }
        }
        else
        {
            cond = &m_condObjectives.at(objective);
            if (wccond == 2 || wccond == 9)
                cond->setLimit(cond->limit() + 1);
        }
        condSuccess->addDependency(cond);
    }
    if (condFailure != NULL)
    {
        int objective = index*2 + 1;
        if (m_condObjectives.find(objective) == m_condObjectives.end())
        {
            cond = &m_condObjectives.emplace(std::piecewise_construct,
                std::forward_as_tuple(objective),
                std::forward_as_tuple(m_scenario, 1)).first->second;
            if (objective < 16)
                cond->addDependency(&m_condFailure);
        }
        else
        {
            cond = &m_condObjectives.at(objective);
            if (wccond == 9)
                cond->setLimit(cond->limit() + 1);
        }
        condFailure->addDependency(cond);
        if (wccond == 6 || wccond == 8)
        {
            condSuccess->addDependency(cond, false);
            cond->setLimit(2);
        }
    }
}
开发者ID:patnashev,项目名称:vertigo,代码行数:92,代码来源:conditionmanager.cpp


注:本文中的Condition::addDependency方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。