本文整理汇总了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);
}
}
}